Repository: yt-dlp/yt-dlp

Issue:
m3u8 is not followed; regression?
### 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)
- [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

Netherlands

### Provide a description that is worded well enough to be understood

Try with old version, works as expected:

```
$ yt-dlp --version
2022.07.18
```
```
$ yt-dlp https://nos.nl/l/2452718
[generic] 2452718: Downloading webpage
[redirect] Following redirect to https://nos.nl/video/2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading webpage
WARNING: [generic] Falling back on generic information extractor.
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Extracting information
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading webpage
[redirect] Following redirect to https://nl-ams-p5-am3.cdn.streamgate.nl/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2Njg3Njc5ODEsInVyaSI6Ilwvdm9kXC9ucG9cL3VzcFwvbm9zXC9obHNfdW5lbmNyeXB0ZWRcL05PU0NfYjQxMGE4Y2JfNmFmMl80YzYxX2FjNDBfMWY3ZDg2Nzg5MmZlXC9OT1NDX2I0MTBhOGNiXzZhZjJfNGM2MV9hYzQwXzFmN2Q4Njc4OTJmZV92MTY2ODY2MzM1NS5pc20iLCJjbGllbnRfaXAiOiI2Mi4xNDUuMTk1LjEzMSIsInZpZXdlciI6Im5vcy1yZXNvbHZlciIsInJpZCI6IjBmMTE0NTQifQ.QAaKfxlwpd4cKA1-0UWEiH0Wx1KgdhoLtjsStic_bpQ/vod/npo/usp/nos/hls_unencrypted/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355.ism/playlist.m3u8
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading webpage
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading m3u8 information
[info] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading 1 format(s): 3812
[hlsnative] Downloading m3u8 manifest
WARNING: Live HLS streams are not supported by the native downloader. If this is a livestream, please add "--downloader ffmpeg --hls-use-mpegts" to your command
[hlsnative] Total fragments: 6
[download] Destination: Xi en Trudeau botsen voor de camera op G20-top - 'Je hebt gelekt' [2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt].mp4
[download] 100% of 19.25MiB in 01:02
[FixupM3u8] Fixing MPEG-TS in MP4 container of "Xi en Trudeau botsen voor de camera op G20-top - 'Je hebt gelekt' [2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt].mp4"
``` 

Try with new version, only downloads m3u8 but does not follow up by downloading the actual content.

```
$  yt-dlp --version
2022.11.11
```
```
$ yt-dlp https://nos.nl/l/2452718
[generic] 2452718: Downloading webpage
[redirect] Following redirect to https://nos.nl/video/2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Extracting information
[info] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading 1 format(s): 0
[download] Destination: Xi en Trudeau botsen voor de camera op G20-top： 'Je hebt gelekt' [2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt].m3u8
[download] 100% of    1.86KiB in 00:00:00 at 7.94KiB/s
```
```
$ cat Xi\ en\ Trudeau\ botsen\ voor\ de\ camera\ op\ G20-top：\ \'Je\ hebt\ gelekt\'\ \[2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt\].m3u8 
#EXTM3U
#EXT-X-VERSION:4
## Created with Unified Streaming Platform(version=1.9.6)

# AUDIO groups
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aacl-128",NAME="audio",AUTOSELECT=YES,DEFAULT=YES,CHANNELS="2"

# variants
#EXT-X-STREAM-INF:BANDWIDTH=667000,CODECS="mp4a.40.2,avc1.42C029",RESOLUTION=640x360,FRAME-RATE=25,VIDEO-RANGE=SDR,AUDIO="audio-aacl-128",CLOSED-CAPTIONS=NONE
NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-audio=128000-video=500645.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1196000,CODECS="mp4a.40.2,avc1.42C029",RESOLUTION=848x480,FRAME-RATE=25,VIDEO-RANGE=SDR,AUDIO="audio-aacl-128",CLOSED-CAPTIONS=NONE
NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-audio=128000-video=1000159.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2225000,CODECS="mp4a.40.2,avc1.4D401F",RESOLUTION=1280x720,FRAME-RATE=25,VIDEO-RANGE=SDR,AUDIO="audio-aacl-128",CLOSED-CAPTIONS=NONE
NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-audio=128000-video=1970249.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3812000,CODECS="mp4a.40.2,avc1.4D4029",RESOLUTION=1920x1080,FRAME-RATE=25,VIDEO-RANGE=SDR,AUDIO="audio-aacl-128",CLOSED-CAPTIONS=NONE
NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-audio=128000-video=3468051.m3u8

# keyframes
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=67000,CODECS="avc1.42C029",RESOLUTION=640x360,URI="keyframes/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-video=500645.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=133000,CODECS="avc1.42C029",RESOLUTION=848x480,URI="keyframes/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-video=1000159.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=262000,CODECS="avc1.4D401F",RESOLUTION=1280x720,URI="keyframes/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-video=1970249.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=460000,CODECS="avc1.4D4029",RESOLUTION=1920x1080,URI="keyframes/NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe_v1668663355-video=3468051.m3u8"

```


### 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: ['https://nos.nl/l/2452718', '-vU']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.11.11 [8b64402] (zip)
[debug] Python 3.8.10 (CPython x86_64 64bit) - Linux-5.4.0-92-generic-x86_64-with-glibc2.29 (OpenSSL 1.1.1f  31 Mar 2020, glibc 2.31)
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[debug] Optional libraries: certifi-2019.11.28, sqlite3-2.6.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] [generic] Extracting URL: https://nos.nl/l/2452718
[generic] 2452718: Downloading webpage
[redirect] Following redirect to https://nos.nl/video/2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt
[debug] [generic] Extracting URL: https://nos.nl/video/2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Extracting information
[debug] Looking for embeds
[debug] Identified a JSON LD
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt: Downloading 1 format(s): 0
[debug] Invoking http downloader on "https://resolver.streaming.api.nos.nl/stream?stream=NOSC_b410a8cb_6af2_4c61_ac40_1f7d867892fe&profile=hls_unencrypted&policy=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjb3JlLm5vcy5ubCIsInN1YiI6Ik5PU0NfYjQxMGE4Y2JfNmFmMl80YzYxX2FjNDBfMWY3ZDg2Nzg5MmZlIiwiYXVkIjpbInJlc29sdmVyLnN0cmVhbWluZy5hcGkubm9zLm5sIl0sImlhdCI6MTY2ODY2NDIyMywiYWxsb3dlZEFyZWFzIjpbXSwiaXNHZW9wcm90ZWN0ZWQiOmZhbHNlfQ.9b_tGgn1hzsxs44FexwEmxX3-31B20NyuokKawp16ts#__youtubedl_smuggle=%7B%22force_videoid%22%3A+%222452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt%22%2C+%22to_generic%22%3A+true%2C+%22http_headers%22%3A+%7B%22Referer%22%3A+%22https%3A%2F%2Fnos.nl%2Fvideo%2F2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt%22%7D%7D"
[download] Destination: Xi en Trudeau botsen voor de camera op G20-top： 'Je hebt gelekt' [2452718-xi-en-trudeau-botsen-voor-de-camera-op-g20-top-je-hebt-gelekt].m3u8
[download] 100% of    1.86KiB in 00:00:00 at 3.66KiB/s
```


Discussion:
can confirm as a regression in 0f60ba6e656516ec24d619d20d61249be6296105

the relevant changes:

https://github.com/yt-dlp/yt-dlp/commit/0f60ba6e656516ec24d619d20d61249be6296105#diff-b7f6633815316063666fc3ecebb970e68fdcb5ee01beba03d04c01830e55e8a6R1542

https://github.com/yt-dlp/yt-dlp/commit/0f60ba6e656516ec24d619d20d61249be6296105#diff-28ac72db5ec9cbb295cfe1f162c6947893d6f348cb3ce76b90a6459194770892R2913

I think if `ext` is `m3u8` then the info_dict's `_type` needs to be `url_transparent`. Or maybe there's a better way to fix it?
> I think if `ext` is `m3u8` then the info_dict's `_type` needs to be `url_transparent`.

Makes sense. Check that ext is not in `utils.MEDIA_EXTENSIONS.manifests`

Resolving patch:
diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py
--- a/yt_dlp/extractor/generic.py
+++ b/yt_dlp/extractor/generic.py
@@ -10,6 +10,7 @@
 from ..compat import compat_etree_fromstring
 from ..utils import (
     KNOWN_EXTENSIONS,
+    MEDIA_EXTENSIONS,
     ExtractorError,
     UnsupportedError,
     determine_ext,
@@ -2572,8 +2573,9 @@ def _extract_embeds(self, url, webpage, *, urlh=None, info_dict={}):
         json_ld = self._search_json_ld(webpage, video_id, default={})
         if json_ld.get('url') not in (url, None):
             self.report_detected('JSON LD')
+            is_direct = json_ld.get('ext') not in (None, *MEDIA_EXTENSIONS.manifests)
             return [merge_dicts({
-                '_type': 'video' if json_ld.get('ext') else 'url_transparent',
+                '_type': 'video' if is_direct else 'url_transparent',
                 'url': smuggle_url(json_ld['url'], {
                     'force_videoid': video_id,
                     'to_generic': True,


Test patch: