mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 17:22:31 +01:00
parent
ab630a57b9
commit
3783b5f1d1
@ -220,16 +220,23 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
|
|
||||||
class ITVBTCCIE(InfoExtractor):
|
class ITVBTCCIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?itv\.com/btcc/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:www\.)?itv\.com/(?:news|btcc)/(?:[^/]+/)*(?P<id>[^/?#&]+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://www.itv.com/btcc/articles/btcc-2019-brands-hatch-gp-race-action',
|
'url': 'https://www.itv.com/btcc/articles/btcc-2019-brands-hatch-gp-race-action',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'btcc-2019-brands-hatch-gp-race-action',
|
'id': 'btcc-2019-brands-hatch-gp-race-action',
|
||||||
'title': 'BTCC 2019: Brands Hatch GP race action',
|
'title': 'BTCC 2019: Brands Hatch GP race action',
|
||||||
},
|
},
|
||||||
'playlist_count': 12,
|
'playlist_count': 12,
|
||||||
}
|
}, {
|
||||||
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1582188683001/HkiHLnNRx_default/index.html?videoId=%s'
|
'url': 'https://www.itv.com/news/2021-10-27/i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'i-have-to-protect-the-country-says-rishi-sunak-as-uk-faces-interest-rate-hike',
|
||||||
|
'title': 'md5:6ef054dd9f069330db3dcc66cb772d32'
|
||||||
|
},
|
||||||
|
'playlist_count': 4
|
||||||
|
}]
|
||||||
|
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
@ -240,15 +247,15 @@ def _real_extract(self, url):
|
|||||||
'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[^>]*>([^<]+)</script>', webpage, 'json_map'), playlist_id),
|
'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[^>]*>([^<]+)</script>', webpage, 'json_map'), playlist_id),
|
||||||
lambda x: x['props']['pageProps']['article']['body']['content']) or []
|
lambda x: x['props']['pageProps']['article']['body']['content']) or []
|
||||||
|
|
||||||
# Discard empty objects
|
entries = []
|
||||||
video_ids = []
|
|
||||||
for video in json_map:
|
for video in json_map:
|
||||||
if video['data'].get('id'):
|
if not any(video['data'].get(attr) == 'Brightcove' for attr in ('name', 'type')):
|
||||||
video_ids.append(video['data']['id'])
|
continue
|
||||||
|
video_id = video['data']['id']
|
||||||
entries = [
|
account_id = video['data']['accountId']
|
||||||
self.url_result(
|
player_id = video['data']['playerId']
|
||||||
smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % video_id, {
|
entries.append(self.url_result(
|
||||||
|
smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % (account_id, player_id, video_id), {
|
||||||
# ITV does not like some GB IP ranges, so here are some
|
# ITV does not like some GB IP ranges, so here are some
|
||||||
# IP blocks it accepts
|
# IP blocks it accepts
|
||||||
'geo_ip_blocks': [
|
'geo_ip_blocks': [
|
||||||
@ -256,8 +263,7 @@ def _real_extract(self, url):
|
|||||||
],
|
],
|
||||||
'referrer': url,
|
'referrer': url,
|
||||||
}),
|
}),
|
||||||
ie=BrightcoveNewIE.ie_key(), video_id=video_id)
|
ie=BrightcoveNewIE.ie_key(), video_id=video_id))
|
||||||
for video_id in video_ids]
|
|
||||||
|
|
||||||
title = self._og_search_title(webpage, fatal=False)
|
title = self._og_search_title(webpage, fatal=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user