2016-06-30 03:54:21 +02:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2017-11-02 14:16:15 +01:00
|
|
|
from ..utils import (
|
|
|
|
extract_attributes,
|
|
|
|
smuggle_url,
|
|
|
|
strip_or_none,
|
|
|
|
urljoin,
|
|
|
|
)
|
2016-06-30 03:54:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SkySportsIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?skysports\.com/watch/video/(?P<id>[0-9]+)'
|
|
|
|
_TEST = {
|
|
|
|
'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
|
2017-01-06 11:22:35 +01:00
|
|
|
'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
|
2016-06-30 03:54:21 +02:00
|
|
|
'info_dict': {
|
|
|
|
'id': '10328419',
|
2017-01-06 11:22:35 +01:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Bale: It\'s our time to shine',
|
|
|
|
'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
|
2016-06-30 03:54:21 +02:00
|
|
|
},
|
|
|
|
'add_ie': ['Ooyala'],
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2017-11-02 14:16:15 +01:00
|
|
|
video_data = extract_attributes(self._search_regex(
|
|
|
|
r'(<div.+?class="sdc-article-video__media-ooyala"[^>]+>)', webpage, 'video data'))
|
|
|
|
|
|
|
|
video_url = 'ooyala:%s' % video_data['data-video-id']
|
|
|
|
if video_data.get('data-token-required') == 'true':
|
|
|
|
token_fetch_options = self._parse_json(video_data.get('data-token-fetch-options', '{}'), video_id, fatal=False) or {}
|
|
|
|
token_fetch_url = token_fetch_options.get('url')
|
|
|
|
if token_fetch_url:
|
|
|
|
embed_token = self._download_webpage(urljoin(url, token_fetch_url), video_id, fatal=False)
|
|
|
|
if embed_token:
|
|
|
|
video_url = smuggle_url(video_url, {'embed_token': embed_token.strip('"')})
|
2016-06-30 03:54:21 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
'_type': 'url_transparent',
|
|
|
|
'id': video_id,
|
2017-11-02 14:16:15 +01:00
|
|
|
'url': video_url,
|
2016-06-30 03:54:21 +02:00
|
|
|
'title': self._og_search_title(webpage),
|
2017-01-06 11:22:35 +01:00
|
|
|
'description': strip_or_none(self._og_search_description(webpage)),
|
2016-06-30 03:54:21 +02:00
|
|
|
'ie_key': 'Ooyala',
|
|
|
|
}
|