[gameinformer] update the extractor to use BrightcoveNewIE
[youtube-dl] / youtube_dl / extractor / gameinformer.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import compat_str
6 from ..utils import int_or_none
7
8
9 class GameInformerIE(InfoExtractor):
10     _VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>.+)\.aspx'
11     _TEST = {
12         'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-crossing.aspx',
13         'md5': '292f26da1ab4beb4c9099f1304d2b071',
14         'info_dict': {
15             'id': '4515472681001',
16             'ext': 'mp4',
17             'title': 'Replay - Animal Crossing',
18             'description': 'md5:2e211891b215c85d061adc7a4dd2d930',
19             'timestamp': 1443457610,
20             'upload_date': '20150928',
21             'uploader_id': '694940074001',
22         },
23     }
24     BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/694940074001/default_default/index.html?videoId=%s'
25
26     def _real_extract(self, url):
27         display_id = self._match_id(url)
28         webpage = self._download_webpage(url, display_id)
29         brightcove_id = self._search_regex(r"getVideo\('[^']+video_id=(\d+)", webpage, 'brightcove id')
30         return self.url_result(self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id)