]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/skysports.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class SkySportsIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?skysports\.com/watch/video/(?P<id>[0-9]+)'
16 'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
17 'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
21 'title': 'Bale: It\'s our time to shine',
22 'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
30 video_data
= extract_attributes(self
._search
_regex
(
31 r
'(<div.+?class="sdc-article-video__media-ooyala"[^>]+>)', webpage
, 'video data'))
33 video_url
= 'ooyala:%s' % video_data
['data-video-id']
34 if video_data
.get('data-token-required') == 'true':
35 token_fetch_options
= self
._parse
_json
(video_data
.get('data-token-fetch-options', '{}'), video_id
, fatal
=False) or {}
36 token_fetch_url
= token_fetch_options
.get('url')
38 embed_token
= self
._download
_webpage
(urljoin(url
, token_fetch_url
), video_id
, fatal
=False)
40 video_url
= smuggle_url(video_url
, {'embed_token': embed_token
.strip('"')})
43 '_type': 'url_transparent',
46 'title': self
._og
_search
_title
(webpage
),
47 'description': strip_or_none(self
._og
_search
_description
(webpage
)),