X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fbilibili.py;h=904d9a8b4e3c71c23e1112c2fc69e6004aedb09d;hb=a4196c3ea57cf06b6d1f961b9c40f65e173c9876;hp=0d5889f5d17c17ffa75eeca1f1079efd7f9c2b8f;hpb=def8b4039f85449eb8aa3e7ad51c706661a1fb75;p=youtube-dl diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 0d5889f5d..904d9a8b4 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -5,10 +5,9 @@ import re from .common import InfoExtractor from ..utils import ( - compat_parse_qs, - ExtractorError, int_or_none, unified_strdate, + ExtractorError, ) @@ -29,10 +28,11 @@ class BiliBiliIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') - + video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) + + if self._search_regex(r'(此视频不存在或被删除)', webpage, 'error message', default=None): + raise ExtractorError('The video does not exist or was deleted', expected=True) video_code = self._search_regex( r'(?s)
(.*?)
', webpage, 'video code') @@ -55,45 +55,38 @@ class BiliBiliIE(InfoExtractor): thumbnail = self._html_search_meta( 'thumbnailUrl', video_code, 'thumbnail', fatal=False) - player_params = compat_parse_qs(self._html_search_regex( - r'