mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 03:32:05 +00:00
[weibo] Add fallback if first pattern fail
This commit is contained in:
parent
1db5ab6b34
commit
fe39d606a1
1 changed files with 12 additions and 2 deletions
|
@ -73,8 +73,18 @@ class WeiboIE(InfoExtractor):
|
|||
webpage = self._download_webpage(
|
||||
url, video_id, note='Revisiting webpage')
|
||||
|
||||
title = self._html_search_regex(
|
||||
r'<title>(.+?)</title>', webpage, 'title')
|
||||
def search_title(webpage):
|
||||
# This may fail if page title contains a line breaks
|
||||
# See #25401
|
||||
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title', default=None)
|
||||
|
||||
if title is None:
|
||||
# Fallback if first pattern fail
|
||||
title = self._search_regex(r'(?:\$CONFIG\[\'title_value\'\]=\'(.+?)\';)', webpage, 'title')
|
||||
|
||||
return title
|
||||
|
||||
title = search_title(webpage)
|
||||
|
||||
video_formats = compat_parse_qs(self._search_regex(
|
||||
r'video-sources=\\\"(.+?)\"', webpage, 'video_sources'))
|
||||
|
|
Loading…
Reference in a new issue