]>
Commit | Line | Data |
---|---|---|
cfe781d4 | 1 | from .brightcove import BrightcoveNewIE |
60121eb5 | 2 | from .common import InfoExtractor |
cfe781d4 RA |
3 | from ..utils import ( |
4 | clean_html, | |
5 | get_element_by_class, | |
6 | get_element_by_id, | |
7 | ) | |
60121eb5 | 8 | |
9 | ||
10 | class GameInformerIE(InfoExtractor): | |
cfe781d4 RA |
11 | _VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>[^.?&#]+)' |
12 | _TESTS = [{ | |
13 | # normal Brightcove embed code extracted with BrightcoveNewIE._extract_url | |
60121eb5 | 14 | 'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-crossing.aspx', |
203f3d77 | 15 | 'md5': '292f26da1ab4beb4c9099f1304d2b071', |
60121eb5 | 16 | 'info_dict': { |
17 | 'id': '4515472681001', | |
203f3d77 | 18 | 'ext': 'mp4', |
60121eb5 | 19 | 'title': 'Replay - Animal Crossing', |
20 | 'description': 'md5:2e211891b215c85d061adc7a4dd2d930', | |
203f3d77 | 21 | 'timestamp': 1443457610, |
22 | 'upload_date': '20150928', | |
23 | 'uploader_id': '694940074001', | |
60121eb5 | 24 | }, |
cfe781d4 RA |
25 | }, { |
26 | # Brightcove id inside unique element with field--name-field-brightcove-video-id class | |
27 | 'url': 'https://www.gameinformer.com/video-feature/new-gameplay-today/2019/07/09/new-gameplay-today-streets-of-rogue', | |
28 | 'info_dict': { | |
29 | 'id': '6057111913001', | |
30 | 'ext': 'mp4', | |
31 | 'title': 'New Gameplay Today – Streets Of Rogue', | |
32 | 'timestamp': 1562699001, | |
33 | 'upload_date': '20190709', | |
34 | 'uploader_id': '694940074001', | |
35 | ||
36 | }, | |
37 | }] | |
203f3d77 | 38 | BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/694940074001/default_default/index.html?videoId=%s' |
60121eb5 | 39 | |
40 | def _real_extract(self, url): | |
41 | display_id = self._match_id(url) | |
9f4ec3de S |
42 | webpage = self._download_webpage( |
43 | url, display_id, headers=self.geo_verification_headers()) | |
cfe781d4 RA |
44 | brightcove_id = clean_html(get_element_by_class('field--name-field-brightcove-video-id', webpage) or get_element_by_id('video-source-content', webpage)) |
45 | brightcove_url = self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id if brightcove_id else BrightcoveNewIE._extract_url(self, webpage) | |
46 | return self.url_result(brightcove_url, 'BrightcoveNew', brightcove_id) |