X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fign.py;h=a96ea801019c808e6a8fe1f8f6590b0e018feeef;hb=HEAD;hp=fa4e673947c395870fe6b4b15c32da74a4bc9616;hpb=adccf33632c51def397cdfb08c1271de6d6ec95e;p=youtube-dl diff --git a/youtube_dl/extractor/ign.py b/youtube_dl/extractor/ign.py index fa4e67394..a96ea8010 100644 --- a/youtube_dl/extractor/ign.py +++ b/youtube_dl/extractor/ign.py @@ -32,6 +32,7 @@ class IGNIE(InfoExtractor): 'description': 'md5:c8946d4260a4d43a00d5ae8ed998870c', 'timestamp': 1370440800, 'upload_date': '20130605', + 'uploader_id': 'cberidon@ign.com', } }, { @@ -48,6 +49,7 @@ class IGNIE(InfoExtractor): 'description': 'Rockstar drops the mic on this generation of games. Watch our review of the masterly Grand Theft Auto V.', 'timestamp': 1379339880, 'upload_date': '20130916', + 'uploader_id': 'danieljkrupa@gmail.com', }, }, { @@ -58,6 +60,7 @@ class IGNIE(InfoExtractor): 'description': 'The twisted beauty of GTA 5 in stunning slow motion.', 'timestamp': 1386878820, 'upload_date': '20131212', + 'uploader_id': 'togilvie@ign.com', }, }, ], @@ -75,8 +78,22 @@ class IGNIE(InfoExtractor): 'description': 'Brian and Jared explore Michel Ancel\'s captivating new preview.', 'timestamp': 1408047180, 'upload_date': '20140814', + 'uploader_id': 'jamesduggan1990@gmail.com', }, }, + { + 'url': 'http://me.ign.com/en/videos/112203/video/how-hitman-aims-to-be-different-than-every-other-s', + 'only_matching': True, + }, + { + 'url': 'http://me.ign.com/ar/angry-birds-2/106533/video/lrd-ldyy-lwl-lfylm-angry-birds', + 'only_matching': True, + }, + { + # videoId pattern + 'url': 'http://www.ign.com/articles/2017/06/08/new-ducktales-short-donalds-birthday-doesnt-go-as-planned', + 'only_matching': True, + }, ] def _find_video_id(self, webpage): @@ -86,6 +103,8 @@ class IGNIE(InfoExtractor): r'data-video-id="(.+?)"', r']*value="[^"]*?url=(https?://www\.ign\.com/videos/.*?)["&]', + r']*value="[^"]*?url=(https?://www\.ign\.com/videos/.*?)["&]', webpage) if multiple_urls: entries = [self.url_result(u, ie='IGN') for u in multiple_urls] @@ -108,19 +127,24 @@ class IGNIE(InfoExtractor): video_id = self._find_video_id(webpage) if not video_id: - return self.url_result(self._search_regex(self._EMBED_RE, webpage, 'embed url')) + return self.url_result(self._search_regex( + self._EMBED_RE, webpage, 'embed url')) return self._get_video_info(video_id) def _get_video_info(self, video_id): - api_data = self._download_json(self._API_URL_TEMPLATE % video_id, video_id) + api_data = self._download_json( + self._API_URL_TEMPLATE % video_id, video_id) formats = [] m3u8_url = api_data['refs'].get('m3uUrl') if m3u8_url: - formats.extend(self._extract_m3u8_formats(m3u8_url, video_id)) + formats.extend(self._extract_m3u8_formats( + m3u8_url, video_id, 'mp4', 'm3u8_native', + m3u8_id='hls', fatal=False)) f4m_url = api_data['refs'].get('f4mUrl') if f4m_url: - formats.extend(self._extract_f4m_formats(f4m_url, video_id)) + formats.extend(self._extract_f4m_formats( + f4m_url, video_id, f4m_id='hds', fatal=False)) for asset in api_data['assets']: formats.append({ 'url': asset['url'], @@ -131,9 +155,9 @@ class IGNIE(InfoExtractor): }) self._sort_formats(formats) - thumbnails = [] - for thumbnail in api_data['thumbnails']: - thumbnails.append({'url': thumbnail['url']}) + thumbnails = [{ + 'url': thumbnail['url'] + } for thumbnail in api_data.get('thumbnails', [])] metadata = api_data['metadata'] @@ -144,6 +168,7 @@ class IGNIE(InfoExtractor): 'timestamp': parse_iso8601(metadata.get('publishDate')), 'duration': int_or_none(metadata.get('duration')), 'display_id': metadata.get('slug') or video_id, + 'uploader_id': metadata.get('creator'), 'thumbnails': thumbnails, 'formats': formats, } @@ -163,6 +188,7 @@ class OneUPIE(IGNIE): 'description': 'md5:bf0516c5ee32a3217aa703e9b1bc7826', 'timestamp': 1313099220, 'upload_date': '20110811', + 'uploader_id': 'IGN', } }] @@ -177,7 +203,7 @@ class PCMagIE(IGNIE): _VALID_URL = r'https?://(?:www\.)?pcmag\.com/(?Pvideos|article2)(/.+)?/(?P.+)' IE_NAME = 'pcmag' - _EMBED_RE = r'iframe.setAttribute\("src",\s*__util.objToUrlString\("http://widgets\.ign\.com/video/embed/content.html?[^"]*url=([^"]+)["&]' + _EMBED_RE = r'iframe\.setAttribute\("src",\s*__util.objToUrlString\("http://widgets\.ign\.com/video/embed/content\.html?[^"]*url=([^"]+)["&]' _TESTS = [{ 'url': 'http://www.pcmag.com/videos/2015/01/06/010615-whats-new-now-is-gogo-snooping-on-your-data', @@ -189,8 +215,9 @@ class PCMagIE(IGNIE): 'description': 'md5:a7071ae64d2f68cc821c729d4ded6bb3', 'timestamp': 1420571160, 'upload_date': '20150106', + 'uploader_id': 'cozzipix@gmail.com', } - },{ + }, { 'url': 'http://www.pcmag.com/article2/0,2817,2470156,00.asp', 'md5': '94130c1ca07ba0adb6088350681f16c1', 'info_dict': { @@ -200,5 +227,6 @@ class PCMagIE(IGNIE): 'description': 'md5:53433c45df96d2ea5d0fda18be2ca908', 'timestamp': 1412953920, 'upload_date': '20141010', + 'uploader_id': 'chris_snyder@pcmag.com', } }]