]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sky.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  13 class SkyBaseIE(InfoExtractor
): 
  14     def _real_extract(self
, url
): 
  15         video_id 
= self
._match
_id
(url
) 
  16         webpage 
= self
._download
_webpage
(url
, video_id
) 
  17         video_data 
= extract_attributes(self
._search
_regex
( 
  18             r
'(<div.+?class="[^"]*sdc-article-video__media-ooyala[^"]*"[^>]+>)', 
  19             webpage
, 'video data')) 
  21         video_url 
= 'ooyala:%s' % video_data
['data-video-id'] 
  22         if video_data
.get('data-token-required') == 'true': 
  23             token_fetch_options 
= self
._parse
_json
(video_data
.get( 
  24                 'data-token-fetch-options', '{}'), video_id
, fatal
=False) or {} 
  25             token_fetch_url 
= token_fetch_options
.get('url') 
  27                 embed_token 
= self
._download
_webpage
(urljoin( 
  28                     url
, token_fetch_url
), video_id
, fatal
=False) 
  30                     video_url 
= smuggle_url( 
  31                         video_url
, {'embed_token': embed_token
.strip('"')}) 
  34             '_type': 'url_transparent', 
  37             'title': self
._og
_search
_title
(webpage
), 
  38             'description': strip_or_none(self
._og
_search
_description
(webpage
)), 
  43 class SkySportsIE(SkyBaseIE
): 
  44     _VALID_URL 
= r
'https?://(?:www\.)?skysports\.com/watch/video/(?P<id>[0-9]+)' 
  46         'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine', 
  47         'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec', 
  49             'id': 'o3eWJnNDE6l7kfNO8BOoBlRxXRQ4ANNQ', 
  51             'title': 'Bale: It\'s our time to shine', 
  52             'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d', 
  58 class SkyNewsIE(SkyBaseIE
): 
  59     _VALID_URL 
= r
'https?://news\.sky\.com/video/[0-9a-z-]+-(?P<id>[0-9]+)' 
  61         'url': 'https://news.sky.com/video/russian-plane-inspected-after-deadly-fire-11712962', 
  62         'md5': 'd6327e581473cea9976a3236ded370cd', 
  64             'id': '1ua21xaDE6lCtZDmbYfl8kwsKLooJbNM', 
  66             'title': 'Russian plane inspected after deadly fire', 
  67             'description': 'The Russian Investigative Committee has released video of the wreckage of a passenger plane which caught fire near Moscow.',