mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 11:41:52 +00:00
[youtube] Improve unavailable message extraction (refs #22117)
This commit is contained in:
parent
0326bcb6c1
commit
0add33abcb
1 changed files with 9 additions and 4 deletions
|
@ -1809,10 +1809,15 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
break
|
break
|
||||||
|
|
||||||
def extract_unavailable_message():
|
def extract_unavailable_message():
|
||||||
return self._html_search_regex(
|
messages = []
|
||||||
(r'(?s)<div[^>]+id=["\']unavailable-submessage["\'][^>]+>(.+?)</div',
|
for tag, kind in (('h1', 'message'), ('div', 'submessage')):
|
||||||
r'(?s)<h1[^>]+id=["\']unavailable-message["\'][^>]*>(.+?)</h1>'),
|
msg = self._html_search_regex(
|
||||||
video_webpage, 'unavailable message', default=None)
|
r'(?s)<{tag}[^>]+id=["\']unavailable-{kind}["\'][^>]*>(.+?)</{tag}>'.format(tag=tag, kind=kind),
|
||||||
|
video_webpage, 'unavailable %s' % kind, default=None)
|
||||||
|
if msg:
|
||||||
|
messages.append(msg)
|
||||||
|
if messages:
|
||||||
|
return '\n'.join(messages)
|
||||||
|
|
||||||
if not video_info:
|
if not video_info:
|
||||||
unavailable_message = extract_unavailable_message()
|
unavailable_message = extract_unavailable_message()
|
||||||
|
|
Loading…
Reference in a new issue