1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 03:32:05 +00:00

[youtube] Don't capture YouTube Red ad for creator meta field (closes #13621)

This commit is contained in:
Sergey M․ 2017-07-14 22:37:04 +07:00
parent 00dbdfc1f7
commit 7d02dcfaa2
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -673,6 +673,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
}, },
}, },
# video_info is None (https://github.com/rg3/youtube-dl/issues/4421) # video_info is None (https://github.com/rg3/youtube-dl/issues/4421)
# YouTube Red ad is not captured for creator
{ {
'url': '__2ABJjxzNo', 'url': '__2ABJjxzNo',
'info_dict': { 'info_dict': {
@ -1649,7 +1650,21 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
video_webpage, 'license', default=None) video_webpage, 'license', default=None)
m_music = re.search( m_music = re.search(
r'<h4[^>]+class="title"[^>]*>\s*Music\s*</h4>\s*<ul[^>]*>\s*<li>(?P<title>.+?) by (?P<creator>.+?)(?:\(.+?\))?</li', r'''(?x)
<h4[^>]+class="title"[^>]*>\s*Music\s*</h4>\s*
<ul[^>]*>\s*
<li>(?P<title>.+?)
by (?P<creator>.+?)
(?:
\(.+?\)|
<a[^>]*
(?:
\bhref=["\']/red[^>]*>| # drop possible
>\s*Listen ad-free with YouTube Red # YouTube Red ad
)
.*?
)?</li
''',
video_webpage) video_webpage)
if m_music: if m_music:
video_alt_title = remove_quotes(unescapeHTML(m_music.group('title'))) video_alt_title = remove_quotes(unescapeHTML(m_music.group('title')))