3 from .common
import InfoExtractor
10 class SkyBaseIE(InfoExtractor
):
11 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
12 _SDC_EL_REGEX
= r
'(?s)(<div[^>]+data-(?:component-name|fn)="sdc-(?:articl|sit)e-video"[^>]*>)'
14 def _process_video_element(self
, webpage
, sdc_el
, url
):
15 sdc
= extract_attributes(sdc_el
)
16 provider
= sdc
.get('data-provider')
17 if provider
== 'brightcove':
18 video_id
= sdc
['data-video-id']
19 account_id
= sdc
.get('data-account-id') or '6058004172001'
20 player_id
= sdc
.get('data-player-id') or 'RC9PQUaJ6'
21 video_url
= self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, video_id
)
22 ie_key
= 'BrightcoveNew'
25 '_type': 'url_transparent',
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
34 info
= self
._process
_video
_element
(webpage
, self
._search
_regex
(
35 self
._SDC
_EL
_REGEX
, webpage
, 'sdc element'), url
)
37 'title': self
._og
_search
_title
(webpage
),
38 'description': strip_or_none(self
._og
_search
_description
(webpage
)),
43 class SkySportsIE(SkyBaseIE
):
44 IE_NAME
= 'sky:sports'
45 _VALID_URL
= r
'https?://(?:www\.)?skysports\.com/watch/video/([^/]+/)*(?P<id>[0-9]+)'
47 'url': 'http://www.skysports.com/watch/video/10328419/bale-its-our-time-to-shine',
48 'md5': '77d59166cddc8d3cb7b13e35eaf0f5ec',
50 'id': 'o3eWJnNDE6l7kfNO8BOoBlRxXRQ4ANNQ',
52 'title': 'Bale: It\'s our time to shine',
53 'description': 'md5:e88bda94ae15f7720c5cb467e777bb6d',
55 'add_ie': ['BrightcoveNew'],
57 'url': 'https://www.skysports.com/watch/video/sports/f1/12160544/abu-dhabi-gp-the-notebook',
58 'only_matching': True,
60 'url': 'https://www.skysports.com/watch/video/tv-shows/12118508/rainford-brent-how-ace-programme-helps',
61 'only_matching': True,
65 class SkyNewsIE(SkyBaseIE
):
67 _VALID_URL
= r
'https?://news\.sky\.com/video/[0-9a-z-]+-(?P<id>[0-9]+)'
69 'url': 'https://news.sky.com/video/russian-plane-inspected-after-deadly-fire-11712962',
70 'md5': '411e8893fd216c75eaf7e4c65d364115',
72 'id': 'ref:1ua21xaDE6lCtZDmbYfl8kwsKLooJbNM',
74 'title': 'Russian plane inspected after deadly fire',
75 'description': 'The Russian Investigative Committee has released video of the wreckage of a passenger plane which caught fire near Moscow.',
76 'uploader_id': '6058004172001',
77 'timestamp': 1567112345,
78 'upload_date': '20190829',
80 'add_ie': ['BrightcoveNew'],
84 class SkyNewsStoryIE(SkyBaseIE
):
85 IE_NAME
= 'sky:news:story'
86 _VALID_URL
= r
'https?://news\.sky\.com/story/[0-9a-z-]+-(?P<id>[0-9]+)'
88 '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',
90 'id': 'ref:0714acb9-123d-42c8-91b8-5c1bc6c73f20',
91 'title': 'md5:e408dd7aad63f31a1817bbe40c7d276f',
92 'description': 'md5:a881e12f49212f92be2befe4a09d288a',
94 'upload_date': '20211027',
95 'timestamp': 1635317494,
96 'uploader_id': '6058004172001',
100 def _real_extract(self
, url
):
101 article_id
= self
._match
_id
(url
)
102 webpage
= self
._download
_webpage
(url
, article_id
)
104 entries
= [self
._process
_video
_element
(webpage
, sdc_el
, url
)
105 for sdc_el
in re
.findall(self
._SDC
_EL
_REGEX
, webpage
)]
107 return self
.playlist_result(
108 entries
, article_id
, self
._og
_search
_title
(webpage
),
109 self
._html
_search
_meta
(['og:description', 'description'], webpage
))
112 class SkySportsNewsIE(SkyBaseIE
):
113 IE_NAME
= 'sky:sports:news'
114 _VALID_URL
= r
'https?://(?:www\.)?skysports\.com/([^/]+/)*news/\d+/(?P<id>\d+)'
116 'url': 'http://www.skysports.com/golf/news/12176/10871916/dustin-johnson-ready-to-conquer-players-championship-at-tpc-sawgrass',
119 'title': 'Dustin Johnson ready to conquer Players Championship at TPC Sawgrass',
120 'description': 'Dustin Johnson is confident he can continue his dominant form in 2017 by adding the Players Championship to his list of victories.',
125 def _real_extract(self
, url
):
126 article_id
= self
._match
_id
(url
)
127 webpage
= self
._download
_webpage
(url
, article_id
)
130 for sdc_el
in re
.findall(self
._SDC
_EL
_REGEX
, webpage
):
131 entries
.append(self
._process
_video
_element
(webpage
, sdc_el
, url
))
133 return self
.playlist_result(
134 entries
, article_id
, self
._og
_search
_title
(webpage
),
135 self
._html
_search
_meta
(['og:description', 'description'], webpage
))