Repository: yt-dlp/yt-dlp

Issue:
NBC extractor not working
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.11.11** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [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 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)
- [ ] 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

USA

### Provide a description that is worded well enough to be understood

The nbc.py extractor stopped working sometime in the past month. I can find the master m3u8 file via a browser's inspector and successfully use it to download the video. The manifests are now on west.manifest.na.theplatform.com instead of nbcmpx-vh.akamaihd.net

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', 'https://www.nbc.com/the-tonight-show/video/james-corden-jenna-ortega-mike-feeney/9000156269']
[debug] User config "PRIVATE/yt-dlp.conf": ['--write-info-json', '--console-title', '-c', '-i', '-w', '--write-sub', '--write-auto-sub', '--all-subs', '--write-description', '--write-all-thumbnails', '--add-metadata', '--write-annotations', '--no-post-overwrites', '-o', '%(title)s [%(id)s, %(format_id)s, %(width)sx%(height)s].%(ext)s', '--abort-on-unavailable-fragment', '--retries', '20', '--fragment-retries', '20', '--hls-prefer-native', '--no-cache-dir', '-S', 'tbr,vbr,abr', '--ap-mso', 'PRIVATE', '--ap-username', 'PRIVATE', '--ap-password', 'PRIVATE']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out cp1252 (No VT), error cp1252 (No VT), screen cp1252 (No VT)
[debug] yt-dlp version 2022.11.11 [8b64402] (pip)
[debug] Python 3.9.7 (PRIVATE) - PRIVATE (OpenSSL 1.1.1l  24 Aug 2021)
[debug] exe versions: ffmpeg 4.4 (setts), ffprobe 4.4, phantomjs 2.1.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.11.0, brotli-1.0.9, certifi-2021.05.30, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.0
[debug] Proxy map: {}
[debug] Loaded 1723 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.11.11, Current version: 2022.11.11
yt-dlp is up to date (2022.11.11)
[debug] [NBC] Extracting URL: https://www.nbc.com/the-tonight-show/video/james-corden-jenna-ortega-mike-feeney/9000156269
[NBC] 9000156269: Downloading JSON metadata
[NBC] 9000156269: Downloading JSON metadata
[debug] [ThePlatform] Extracting URL: http://link.theplatform.com/s/NnzsPC/media/guid/2410887629/9000156269?mbr=true&manifest=m3u#__youtubedl_smuggle=%7B%22force_smil_url%22%3A+true%7D
[ThePlatform] 9000156269: Downloading SMIL data
[ThePlatform] 9000156269: Downloading m3u8 information
WARNING: [ThePlatform] Failed to download m3u8 information: HTTP Error 400: Bad Request
[debug] Sort order given by user: tbr, vbr, abr
[debug] Formats sorted by: hasvid, ie_pref, tbr, vbr, abr, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, asr, proto, vext, aext, hasaud, source, id
[ThePlatform] 9000156269: Downloading JSON metadata
[info] 9000156269: Downloading subtitles: en
WARNING: Only images are available for download. use --list-formats to see them
[debug] Default format spec: bestvideo*+bestaudio/best
ERROR: [ThePlatform] 9000156269: Requested format is not available. Use --list-formats for a list of available formats
Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1485, in wrapper
    return func(self, *args, **kwargs)
  File "C:/msys64/mingw64/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1582, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "C:/msys64/mingw64/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1694, in process_ie_result
    return self.process_ie_result(
  File "C:/msys64/mingw64/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1641, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "C:/msys64/mingw64/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 2701, in process_video_result
    raise ExtractorError(
yt_dlp.utils.ExtractorError: [ThePlatform] 9000156269: Requested format is not available. Use --list-formats for a list of available formats
```



Discussion:
The extractor is asking ThePlatform for the formats and being given the Akamai manifest (the same one, 6 times), which in turn gives 400. It's either asking the wrong question or asking the wrong video platform.

Also repeatable for yt-dl where the relevant extractor modules are essentially identical.

But easier to debug in region.
Strangely, in my browser I'm still being served the `nbcmpx-vh.akamaihd.net` manifest URLs and getting the same 400 error. Episodes won't play
I found that adding `'switch': 'HLSServiceSecure',` to [this dict](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/nbc.py#L136-L139) fixed the issue, but I am not sure what it really means...
Also works for yt-dl.

The augmented query is passed to ThePlatform and its presence in the `smil_url` causes the XML request to return a document containing a different Akamai manifest:
```diff
-https://nbcmpx-vh.akamaihd.net/i/prod/video/JiV/0SY/9000156269/1671273605538-_NWk_/HD_TVE_THETONIGHT_12162022_,185,783,483,300,86,35,0k.mp4.csmil/master.m3u8?hdnea=st=1672844683~exp=1672857313~acl=/i/prod/video/JiV/0SY/9000156269/1671273605538-_NWk_/HD_TVE_THETONIGHT_12162022_*~id=b1ad3695-133a-4e15-98d4-937cdb0427b9~hmac=211bf8175d29aa160a013a57118ae246358cc465ddd3064a6679a6294b76b213
+https://vod-lf-oneapp-prd.akamaized.net/prod/video/JiV/0SY/9000156269/1671273605538-_NWk_/master_hls.m3u8
```
I suppose other providers who use ThePlatform might also choose this option.

Resolving patch:
diff --git a/yt_dlp/extractor/nbc.py b/yt_dlp/extractor/nbc.py
--- a/yt_dlp/extractor/nbc.py
+++ b/yt_dlp/extractor/nbc.py
@@ -136,6 +136,7 @@ def _real_extract(self, url):
         query = {
             'mbr': 'true',
             'manifest': 'm3u',
+            'switch': 'HLSServiceSecure',
         }
         video_id = video_data['mpxGuid']
         tp_path = 'NnzsPC/media/guid/%s/%s' % (video_data.get('mpxAccountId') or '2410887629', video_id)


Test patch: