Repository: yt-dlp/yt-dlp

Issue:
CBC player has new URL formats that breaks downloads
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Worldwide

### Provide a description that is worded well enough to be understood

The URLs used to use the same ID that was also used on ThePlatform, meaning that the URL could be easily transformed into a URL for ThePlatform (see [https://github.com/yt-dlp/yt-dlp/blob/e5d4f11104ce7ea1717a90eea82c0f7d230ea5d5/yt_dlp/extractor/cbc.py#L244](url)). The URL now uses an internal ID instead, which breaks the extractor. I haven't gotten around to fixing the code, but I have had the time to look into what is needed to extract the video:

- The regex needs to be changed to accept a dot in the ID (example ID: `1.7154317`)
- The webpage needs to be downloaded and json code needs to be extracted (the same component needs to be extracted as in [https://github.com/yt-dlp/yt-dlp/blob/e5d4f11104ce7ea1717a90eea82c0f7d230ea5d5/yt_dlp/extractor/cbc.py#L273](url))
- In the json code, the media ID has to be extracted, it's located in `video/currentClip/mediaID`
- that mediaID can then be used to construct the ThePlatform URL in the same way as before

Maybe I'll get around to taking care of this in the coming days. If anyone else wants to take care of it, feel free.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['https://www.cbc.ca/player/play/1.7154309', '-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version stable@2024.03.10 from yt-dlp/yt-dlp [615a84447] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-7-6.1.7601-SP1 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Post-Processor Plugins: CheckVideoIntegrityPP
[debug] Plugin directories: ['C:\\Users\\Benjamin\\AppData\\Local\\yt-dlp\\yt-dlp-plugins\\CheckVideoIntegrity\\yt_dlp_plugins', 'C:\\Users\\Benjamin\\AppData\\Local\\yt-dlp\\yt-dlp-plugins\\yt-dont-lock-p\\yt_dlp_plugins']
[debug] Loaded 1803 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.03.10 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.03.10 from yt-dlp/yt-dlp)
[cbc.ca:player] Extracting URL: https://www.cbc.ca/player/play/1.7154309
[ThePlatform] Extracting URL: http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/1?mbr=true&formats=MPEG4,FLV,MP3#__youtubedl_smuggle=%7B%22force_smil_url%22%3A+true%7D
[ThePlatform] 1: Downloading SMIL data
ERROR: [ThePlatform] 1: Unable to download XML: HTTP Error 404: Not Found (caused by <HTTPError 404: Not Found>)
  File "yt_dlp\extractor\common.py", line 732, in extract
  File "yt_dlp\extractor\theplatform.py", line 315, in _real_extract
  File "yt_dlp\extractor\theplatform.py", line 36, in _extract_theplatform_smil
  File "yt_dlp\extractor\common.py", line 1086, in download_content
  File "yt_dlp\extractor\common.py", line 1050, in download_handle
  File "yt_dlp\extractor\adobepass.py", line 1366, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 920, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 877, in _request_webpage

  File "yt_dlp\extractor\common.py", line 864, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 4101, in urlopen
  File "yt_dlp\networking\common.py", line 115, in send
  File "yt_dlp\networking\_helper.py", line 204, in wrapper
  File "yt_dlp\networking\common.py", line 326, in send
  File "yt_dlp\networking\_requests.py", line 351, in _send
yt_dlp.networking.exceptions.HTTPError: HTTP Error 404: Not Found
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/cbc.py b/yt_dlp/extractor/cbc.py
--- a/yt_dlp/extractor/cbc.py
+++ b/yt_dlp/extractor/cbc.py
@@ -151,7 +151,7 @@ def _real_extract(self, url):
 
 class CBCPlayerIE(InfoExtractor):
     IE_NAME = 'cbc.ca:player'
-    _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>\d+)'
+    _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/play/|i/caffeine/syndicate/\?mediaId=))(?P<id>(?:\d\.)?\d+)'
     _TESTS = [{
         'url': 'http://www.cbc.ca/player/play/2683190193',
         'md5': '64d25f841ddf4ddb28a235338af32e2c',
@@ -165,9 +165,52 @@ class CBCPlayerIE(InfoExtractor):
             'uploader': 'CBCC-NEW',
         },
         'skip': 'Geo-restricted to Canada and no longer available',
+    }, {
+        'url': 'http://www.cbc.ca/i/caffeine/syndicate/?mediaId=2657631896',
+        'md5': 'e5e708c34ae6fca156aafe17c43e8b75',
+        'info_dict': {
+            'id': '2657631896',
+            'ext': 'mp3',
+            'title': 'CBC Montreal is organizing its first ever community hackathon!',
+            'description': 'md5:dd3b692f0a139b0369943150bd1c46a9',
+            'timestamp': 1425704400,
+            'upload_date': '20150307',
+            'uploader': 'CBCC-NEW',
+            'thumbnail': 'http://thumbnails.cbc.ca/maven_legacy/thumbnails/sonali-karnick-220.jpg',
+            'chapters': [],
+            'duration': 494.811,
+            'categories': ['AudioMobile/All in a Weekend Montreal'],
+            'tags': 'count:8',
+            'location': 'Quebec',
+            'series': 'All in a Weekend Montreal',
+            'season': 'Season 2015',
+            'season_number': 2015,
+            'media_type': 'Excerpt',
+        },
+    }, {
+        'url': 'http://www.cbc.ca/i/caffeine/syndicate/?mediaId=2164402062',
+        'md5': '33fcd8f6719b9dd60a5e73adcb83b9f6',
+        'info_dict': {
+            'id': '2164402062',
+            'ext': 'mp4',
+            'title': 'Cancer survivor four times over',
+            'description': 'Tim Mayer has beaten three different forms of cancer four times in five years.',
+            'timestamp': 1320410746,
+            'upload_date': '20111104',
+            'uploader': 'CBCC-NEW',
+            'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/277/67/cancer_852x480_2164412612.jpg',
+            'chapters': [],
+            'duration': 186.867,
+            'series': 'CBC News: Windsor at 6:00',
+            'categories': ['News/Canada/Windsor'],
+            'location': 'Windsor',
+            'tags': ['cancer'],
+            'creators': ['Allison Johnson'],
+            'media_type': 'Excerpt',
+        },
     }, {
         # Redirected from http://www.cbc.ca/player/AudioMobile/All%20in%20a%20Weekend%20Montreal/ID/2657632011/
-        'url': 'http://www.cbc.ca/player/play/2657631896',
+        'url': 'https://www.cbc.ca/player/play/1.2985700',
         'md5': 'e5e708c34ae6fca156aafe17c43e8b75',
         'info_dict': {
             'id': '2657631896',
@@ -189,7 +232,7 @@ class CBCPlayerIE(InfoExtractor):
             'media_type': 'Excerpt',
         },
     }, {
-        'url': 'http://www.cbc.ca/player/play/2164402062',
+        'url': 'https://www.cbc.ca/player/play/1.1711287',
         'md5': '33fcd8f6719b9dd60a5e73adcb83b9f6',
         'info_dict': {
             'id': '2164402062',
@@ -206,38 +249,53 @@ class CBCPlayerIE(InfoExtractor):
             'categories': ['News/Canada/Windsor'],
             'location': 'Windsor',
             'tags': ['cancer'],
-            'creator': 'Allison Johnson',
+            'creators': ['Allison Johnson'],
             'media_type': 'Excerpt',
         },
     }, {
         # Has subtitles
         # These broadcasts expire after ~1 month, can find new test URL here:
         # https://www.cbc.ca/player/news/TV%20Shows/The%20National/Latest%20Broadcast
-        'url': 'http://www.cbc.ca/player/play/2284799043667',
-        'md5': '9b49f0839e88b6ec0b01d840cf3d42b5',
+        'url': 'https://www.cbc.ca/player/play/1.7159484',
+        'md5': '6ed6cd0fc2ef568d2297ba68a763d455',
         'info_dict': {
-            'id': '2284799043667',
+            'id': '2324213316001',
             'ext': 'mp4',
-            'title': 'The National | Hockey coach charged, Green grants, Safer drugs',
-            'description': 'md5:84ef46321c94bcf7d0159bb565d26bfa',
-            'timestamp': 1700272800,
-            'duration': 2718.833,
+            'title': 'The National | School boards sue social media giants',
+            'description': 'md5:4b4db69322fa32186c3ce426da07402c',
+            'timestamp': 1711681200,
+            'duration': 2743.400,
             'subtitles': {'eng': [{'ext': 'vtt', 'protocol': 'm3u8_native'}]},
-            'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/907/171/thumbnail.jpeg',
+            'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/607/559/thumbnail.jpeg',
             'uploader': 'CBCC-NEW',
             'chapters': 'count:5',
-            'upload_date': '20231118',
+            'upload_date': '20240329',
             'categories': 'count:4',
             'series': 'The National - Full Show',
             'tags': 'count:1',
-            'creator': 'News',
+            'creators': ['News'],
             'location': 'Canada',
             'media_type': 'Full Program',
         },
+    }, {
+        'url': 'cbcplayer:1.7159484',
+        'only_matching': True,
+    }, {
+        'url': 'cbcplayer:2164402062',
+        'only_matching': True,
+    }, {
+        'url': 'http://www.cbc.ca/player/play/2657631896',
+        'only_matching': True,
     }]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
+        if '.' in video_id:
+            webpage = self._download_webpage(f'https://www.cbc.ca/player/play/{video_id}', video_id)
+            video_id = self._search_json(
+                r'window\.__INITIAL_STATE__\s*=', webpage,
+                'initial state', video_id)['video']['currentClip']['mediaId']
+
         return {
             '_type': 'url_transparent',
             'ie_key': 'ThePlatform',


Test patch: