mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 22:35:21 +00:00
[weibo] Add fallback if first pattern fail
This commit is contained in:
parent
1db5ab6b34
commit
fe39d606a1
@ -73,8 +73,18 @@ class WeiboIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
url, video_id, note='Revisiting webpage')
|
url, video_id, note='Revisiting webpage')
|
||||||
|
|
||||||
title = self._html_search_regex(
|
def search_title(webpage):
|
||||||
r'<title>(.+?)</title>', webpage, 'title')
|
# 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(
|
video_formats = compat_parse_qs(self._search_regex(
|
||||||
r'video-sources=\\\"(.+?)\"', webpage, 'video_sources'))
|
r'video-sources=\\\"(.+?)\"', webpage, 'video_sources'))
|
||||||
|
Loading…
Reference in New Issue
Block a user