3 from .common
import InfoExtractor
12 class SkyBaseIE(InfoExtractor
):
13 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
14 _SDC_EL_REGEX
= r
'(?s)(<div[^>]+data-(?:component-name|fn)="sdc-(?:articl|sit)e-video"[^>]*>)'
16 def _process_ooyala_element(self
, webpage
, sdc_el
, url
):
17 sdc
= extract_attributes(sdc_el
)
18 provider
= sdc
.get('data-provider')
19 if provider
== 'ooyala':
20 video_id
= sdc
['data-sdc-video-id']
21 video_url
= 'ooyala:%s' % video_id
23 ooyala_el
= self
._search
_regex
(
24 r
'(<div[^>]+class="[^"]*\bsdc-article-video__media-ooyala\b[^"]*"[^>]+data-video-id="%s"[^>]*>)' % video_id
,
25 webpage
, 'video data', fatal
=False)
27 ooyala_attrs
= extract_attributes(ooyala_el
) or {}
28 if ooyala_attrs
.get('data-token-required') == 'true':
29 token_fetch_url
= (self
._parse
_json
(ooyala_attrs
.get(
30 'data-token-fetch-options', '{}'),
31 video_id
, fatal
=False) or {}).get('url')
33 embed_token
= self
._download
_json
(urljoin(
34 url
, token_fetch_url
), video_id
, fatal
=False)
36 video_url
= smuggle_url(
37 video_url
, {'embed_token': embed_token}
)
38 elif provider
== 'brightcove':
39 video_id
= sdc
['data-video-id']
40 account_id
= sdc
.get('data-account-id') or '6058004172001'
41 player_id
= sdc
.get('data-player-id') or 'RC9PQUaJ6'
42 video_url
= self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, video_id
)
43 ie_key
= 'BrightcoveNew'
46 '_type': 'url_transparent',
52 def _real_extract(self
, url
):
53 video_id
= self
._match
_id
(url
)
54 webpage
= self
._download
_webpage
(url
, video_id
)
55 info
= self
._process
_ooyala
_element
(webpage
, self
._search
_regex
(
56 self
._SDC
_EL
_REGEX
, webpage
, 'sdc element'), url
)
58 'title': self
._og
_search
_title
(webpage
),
59 'description': strip_or_none(self
._og
_search
_description
(webpage
)),
64 class SkySportsIE(SkyBaseIE
):
65 IE_NAME
= 'sky:sports'
66 _VALID_URL
= r
'https?://(?:www\.)?skysports\.com/watch/video/([^/]+/)*(?P<id>[0-9]+)'
68 'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
69 'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
71 'id': 'o3eWJnNDE6l7kfNO8BOoBlRxXRQ4ANNQ',
73 'title': 'Bale: It\'s our time to shine',
74 'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
78 'url': 'https://www.skysports.com/watch/video/sports/f1/12160544/abu-dhabi-gp-the-notebook',
79 'only_matching': True,
81 'url': 'https://www.skysports.com/watch/video/tv-shows/12118508/rainford-brent-how-ace-programme-helps',
82 'only_matching': True,
86 class SkyNewsIE(SkyBaseIE
):
88 _VALID_URL
= r
'https?://news\.sky\.com/video/[0-9a-z-]+-(?P<id>[0-9]+)'
90 'url': 'https://news.sky.com/video/russian-plane-inspected-after-deadly-fire-11712962',
91 'md5': '411e8893fd216c75eaf7e4c65d364115',
93 'id': 'ref:1ua21xaDE6lCtZDmbYfl8kwsKLooJbNM',
95 'title': 'Russian plane inspected after deadly fire',
96 'description': 'The Russian Investigative Committee has released video of the wreckage of a passenger plane which caught fire near Moscow.',
97 'uploader_id': '6058004172001',
98 'timestamp': 1567112345,
99 'upload_date': '20190829',
101 'add_ie': ['BrightcoveNew'],
105 class SkyNewsStoryIE(SkyBaseIE
):
106 IE_NAME
= 'sky:news:story'
107 _VALID_URL
= r
'https?://news\.sky\.com/story/[0-9a-z-]+-(?P<id>[0-9]+)'
109 'url': 'https://news.sky.com/story/budget-2021-chancellor-rishi-sunak-vows-address-will-deliver-strong-economy-fit-for-a-new-age-of-optimism-12445425',
111 'id': 'ref:0714acb9-123d-42c8-91b8-5c1bc6c73f20',
112 'title': 'md5:e408dd7aad63f31a1817bbe40c7d276f',
113 'description': 'md5:a881e12f49212f92be2befe4a09d288a',
115 'upload_date': '20211027',
116 'timestamp': 1635317494,
117 'uploader_id': '6058004172001',
121 def _real_extract(self
, url
):
122 article_id
= self
._match
_id
(url
)
123 webpage
= self
._download
_webpage
(url
, article_id
)
125 entries
= [self
._process
_ooyala
_element
(webpage
, sdc_el
, url
)
126 for sdc_el
in re
.findall(self
._SDC
_EL
_REGEX
, webpage
)]
128 return self
.playlist_result(
129 entries
, article_id
, self
._og
_search
_title
(webpage
),
130 self
._html
_search
_meta
(['og:description', 'description'], webpage
))
133 class SkySportsNewsIE(SkyBaseIE
):
134 IE_NAME
= 'sky:sports:news'
135 _VALID_URL
= r
'https?://(?:www\.)?skysports\.com/([^/]+/)*news/\d+/(?P<id>\d+)'
137 'url': 'http://www.skysports.com/golf/news/12176/10871916/dustin-johnson-ready-to-conquer-players-championship-at-tpc-sawgrass',
140 'title': 'Dustin Johnson ready to conquer Players Championship at TPC Sawgrass',
141 'description': 'Dustin Johnson is confident he can continue his dominant form in 2017 by adding the Players Championship to his list of victories.',
146 def _real_extract(self
, url
):
147 article_id
= self
._match
_id
(url
)
148 webpage
= self
._download
_webpage
(url
, article_id
)
151 for sdc_el
in re
.findall(self
._SDC
_EL
_REGEX
, webpage
):
152 entries
.append(self
._process
_ooyala
_element
(webpage
, sdc_el
, url
))
154 return self
.playlist_result(
155 entries
, article_id
, self
._og
_search
_title
(webpage
),
156 self
._html
_search
_meta
(['og:description', 'description'], webpage
))