1
0
mirror of https://github.com/l1ving/youtube-dl synced 2020-11-18 19:53:54 -08:00

[Youtube] Add game extractor

Adds the ability for the Youtube extractor to fetch the selected game on a video.
The first regex is for games which have an image, the second for games which don't.
This commit is contained in:
CommanderRoot 2016-10-16 05:34:47 +02:00 committed by GitHub
parent bbd7706898
commit f3679b67ca

View File

@ -1357,6 +1357,15 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
else:
video_description = ''
# game
video_game = self._html_search_regex(
r'<h4[^>]+class="title"[^>]*>\s*Game\s*</h4>\s*(<span[^>]*>.*\s*.*\s*.*\s.*\s*</span>\s*)?<ul[^>]*>\s*<li><a[^>]*>(?P<game>.+?)</a></li',
video_webpage, 'game', default=None, group="game")
if video_game is None:
video_game = self._html_search_regex(
r'<h4[^>]+class="title"[^>]*>\s*Game\s*</h4>\s*(<span[^>]*>.*\s*.*\s*.*\s.*\s*</span>\s*)?<ul[^>]*>\s*<li>(?P<game>.+?)( \(<a .*>.*</a>\))?</li',
video_webpage, 'game', default=None, group="game")
if 'multifeed_metadata_list' in video_info and not smuggled_data.get('force_singlefeed', False):
if not self._downloader.params.get('noplaylist'):
entries = []
@ -1722,6 +1731,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'thumbnail': video_thumbnail,
'description': video_description,
'categories': video_categories,
'game': video_game,
'tags': video_tags,
'subtitles': video_subtitles,
'automatic_captions': automatic_captions,