2015-11-26 13:43:31 -08:00
|
|
|
|
# coding: utf-8
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
2019-07-10 07:45:00 -07:00
|
|
|
|
from .brightcove import BrightcoveNewIE
|
2015-11-26 13:43:31 -08:00
|
|
|
|
from .common import InfoExtractor
|
2019-07-10 07:45:00 -07:00
|
|
|
|
from ..utils import (
|
|
|
|
|
clean_html,
|
|
|
|
|
get_element_by_class,
|
|
|
|
|
get_element_by_id,
|
|
|
|
|
)
|
2015-11-26 13:43:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GameInformerIE(InfoExtractor):
|
2019-07-10 07:45:00 -07:00
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>[^.?&#]+)'
|
|
|
|
|
_TESTS = [{
|
|
|
|
|
# normal Brightcove embed code extracted with BrightcoveNewIE._extract_url
|
2015-11-26 13:43:31 -08:00
|
|
|
|
'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-crossing.aspx',
|
2016-03-14 10:32:29 -07:00
|
|
|
|
'md5': '292f26da1ab4beb4c9099f1304d2b071',
|
2015-11-26 13:43:31 -08:00
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '4515472681001',
|
2016-03-14 10:32:29 -07:00
|
|
|
|
'ext': 'mp4',
|
2015-11-26 13:43:31 -08:00
|
|
|
|
'title': 'Replay - Animal Crossing',
|
|
|
|
|
'description': 'md5:2e211891b215c85d061adc7a4dd2d930',
|
2016-03-14 10:32:29 -07:00
|
|
|
|
'timestamp': 1443457610,
|
|
|
|
|
'upload_date': '20150928',
|
|
|
|
|
'uploader_id': '694940074001',
|
2015-11-26 13:43:31 -08:00
|
|
|
|
},
|
2019-07-10 07:45:00 -07:00
|
|
|
|
}, {
|
|
|
|
|
# Brightcove id inside unique element with field--name-field-brightcove-video-id class
|
|
|
|
|
'url': 'https://www.gameinformer.com/video-feature/new-gameplay-today/2019/07/09/new-gameplay-today-streets-of-rogue',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '6057111913001',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'New Gameplay Today – Streets Of Rogue',
|
|
|
|
|
'timestamp': 1562699001,
|
|
|
|
|
'upload_date': '20190709',
|
|
|
|
|
'uploader_id': '694940074001',
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}]
|
2016-03-14 10:32:29 -07:00
|
|
|
|
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/694940074001/default_default/index.html?videoId=%s'
|
2015-11-26 13:43:31 -08:00
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
display_id = self._match_id(url)
|
2018-02-07 06:52:15 -08:00
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
|
url, display_id, headers=self.geo_verification_headers())
|
2019-07-10 07:45:00 -07:00
|
|
|
|
brightcove_id = clean_html(get_element_by_class('field--name-field-brightcove-video-id', webpage) or get_element_by_id('video-source-content', webpage))
|
|
|
|
|
brightcove_url = self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id if brightcove_id else BrightcoveNewIE._extract_url(self, webpage)
|
|
|
|
|
return self.url_result(brightcove_url, 'BrightcoveNew', brightcove_id)
|