mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[addanime] catch 'RegexNotFoundError'
This commit is contained in:
parent
14e10b2b6e
commit
aee5e18c8f
1 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
||||||
compat_urllib_parse_urlparse,
|
compat_urllib_parse_urlparse,
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
RegexNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,11 +61,13 @@ def _real_extract(self, url):
|
||||||
note=u'Confirming after redirect')
|
note=u'Confirming after redirect')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
try:
|
||||||
video_url = self._search_regex(r"var hq_video_file = '(.*?)';",
|
video_url = self._search_regex(r"var hq_video_file = '(.*?)';",
|
||||||
webpage, u'video file URL')
|
webpage, u'video file URL')
|
||||||
if not video_url: # if there's no hq_video_file, get normal_video_file
|
except RegexNotFoundError:
|
||||||
video_url = self._search_regex(r"var normal_video_file = '(.*?)';",
|
video_url = self._search_regex(r"var normal_video_file = '(.*?)';",
|
||||||
webpage, u'video file URL')
|
webpage, u'video file URL')
|
||||||
|
|
||||||
video_extension = video_url[-3:] # mp4 or flv ?
|
video_extension = video_url[-3:] # mp4 or flv ?
|
||||||
video_title = self._og_search_title(webpage)
|
video_title = self._og_search_title(webpage)
|
||||||
video_description = self._og_search_description(webpage)
|
video_description = self._og_search_description(webpage)
|
||||||
|
|
Loading…
Reference in a new issue