aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authormakeworld <25111343+makeworld-the-better-one@users.noreply.github.com>2021-10-21 20:56:29 -0400
committerGitHub <noreply@github.com>2021-10-22 06:26:29 +0530
commit3c239332b0df3b22a5cbd66930ad240d2398fb44 (patch)
tree2046d642c422d61d9a957ce58999a59a39f617ed /yt_dlp
parentab2ffab22d02d530e0b46f9e361ff53a2139898b (diff)
downloadhypervideo-pre-3c239332b0df3b22a5cbd66930ad240d2398fb44.tar.lz
hypervideo-pre-3c239332b0df3b22a5cbd66930ad240d2398fb44.tar.xz
hypervideo-pre-3c239332b0df3b22a5cbd66930ad240d2398fb44.zip
[CBC] Fix Gem livestream (#1289)
Authored by: makeworld-the-better-one
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/extractor/cbc.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/yt_dlp/extractor/cbc.py b/yt_dlp/extractor/cbc.py
index 5e4526c53..61fe4074c 100644
--- a/yt_dlp/extractor/cbc.py
+++ b/yt_dlp/extractor/cbc.py
@@ -377,7 +377,7 @@ class CBCGemPlaylistIE(InfoExtractor):
class CBCGemLiveIE(InfoExtractor):
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 = {
'url': 'https://gem.cbc.ca/live/920604739687',
'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
# 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):
video_id = self._match_id(url)
- live_info = self._download_json(self._API, video_id)['entries']
- video_info = None
- for stream in live_info:
- if stream.get('guid') == video_id:
- video_info = stream
-
- if video_info is None:
- raise ExtractorError(
- 'Couldn\'t find video metadata, maybe this livestream is now offline',
- expected=True)
+ for api_url in self._API_URLS:
+ video_info = next((
+ stream for stream in self._download_json(api_url, video_id)['entries']
+ if stream.get('guid') == video_id), None)
+ if video_info:
+ break
+ else:
+ raise ExtractorError('Couldn\'t find video metadata, maybe this livestream is now offline', expected=True)
return {
'_type': 'url_transparent',