]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/gameinformer.py
2 from __future__
import unicode_literals
4 from .brightcove
import BrightcoveNewIE
5 from .common
import InfoExtractor
13 class GameInformerIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>[^.?&#]+)'
16 # normal Brightcove embed code extracted with BrightcoveNewIE._extract_url
17 'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-crossing.aspx',
18 'md5': '292f26da1ab4beb4c9099f1304d2b071',
20 'id': '4515472681001',
22 'title': 'Replay - Animal Crossing',
23 'description': 'md5:2e211891b215c85d061adc7a4dd2d930',
24 'timestamp': 1443457610,
25 'upload_date': '20150928',
26 'uploader_id': '694940074001',
29 # Brightcove id inside unique element with field--name-field-brightcove-video-id class
30 'url': 'https://www.gameinformer.com/video-feature/new-gameplay-today/2019/07/09/new-gameplay-today-streets-of-rogue',
32 'id': '6057111913001',
34 'title': 'New Gameplay Today – Streets Of Rogue',
35 'timestamp': 1562699001,
36 'upload_date': '20190709',
37 'uploader_id': '694940074001',
41 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/694940074001/default_default/index.html?videoId=%s'
43 def _real_extract(self
, url
):
44 display_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(
46 url
, display_id
, headers
=self
.geo_verification_headers())
47 brightcove_id
= clean_html(get_element_by_class('field--name-field-brightcove-video-id', webpage
) or get_element_by_id('video-source-content', webpage
))
48 brightcove_url
= self
.BRIGHTCOVE_URL_TEMPLATE
% brightcove_id
if brightcove_id
else BrightcoveNewIE
._extract
_url
(self
, webpage
)
49 return self
.url_result(brightcove_url
, 'BrightcoveNew', brightcove_id
)