mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-04 20:17:22 +01:00
parent
ab2ffab22d
commit
3c239332b0
@ -377,7 +377,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
class CBCGemLiveIE(InfoExtractor):
|
class CBCGemLiveIE(InfoExtractor):
|
||||||
IE_NAME = 'gem.cbc.ca:live'
|
IE_NAME = 'gem.cbc.ca:live'
|
||||||
_VALID_URL = r'https?://gem\.cbc\.ca/live/(?P<id>[0-9]{12})'
|
_VALID_URL = r'https?://gem\.cbc\.ca/live/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://gem.cbc.ca/live/920604739687',
|
'url': 'https://gem.cbc.ca/live/920604739687',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -396,21 +396,21 @@ class CBCGemLiveIE(InfoExtractor):
|
|||||||
|
|
||||||
# It's unclear where the chars at the end come from, but they appear to be
|
# It's unclear where the chars at the end come from, but they appear to be
|
||||||
# constant. Might need updating in the future.
|
# constant. Might need updating in the future.
|
||||||
_API = 'https://tpfeed.cbc.ca/f/ExhSPC/t_t3UKJR6MAT'
|
# There are two URLs, some livestreams are in one, and some
|
||||||
|
# in the other. The JSON schema is the same for both.
|
||||||
|
_API_URLS = ['https://tpfeed.cbc.ca/f/ExhSPC/t_t3UKJR6MAT', 'https://tpfeed.cbc.ca/f/ExhSPC/FNiv9xQx_BnT']
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
live_info = self._download_json(self._API, video_id)['entries']
|
|
||||||
|
|
||||||
video_info = None
|
for api_url in self._API_URLS:
|
||||||
for stream in live_info:
|
video_info = next((
|
||||||
if stream.get('guid') == video_id:
|
stream for stream in self._download_json(api_url, video_id)['entries']
|
||||||
video_info = stream
|
if stream.get('guid') == video_id), None)
|
||||||
|
if video_info:
|
||||||
if video_info is None:
|
break
|
||||||
raise ExtractorError(
|
else:
|
||||||
'Couldn\'t find video metadata, maybe this livestream is now offline',
|
raise ExtractorError('Couldn\'t find video metadata, maybe this livestream is now offline', expected=True)
|
||||||
expected=True)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
|
Loading…
Reference in New Issue
Block a user