Repository: yt-dlp/yt-dlp

Issue:
[CloudflareStream] Ignoring subtitle tracks found in the HLS manifest
### 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

Western Europe

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

Seems similar to https://github.com/yt-dlp/yt-dlp/issues/6191

Also tried with various regex for `--sub-lang`, same results

```m3u8
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_audio",NAME="original",LANGUAGE="en-faa0ff54",DEFAULT=YES,AUTOSELECT=YES,URI="stream_tfaa0ff54daf67c4d1dab4da7da178143_r164817190.m3u8?useMezzanine=true"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="group_subtitle",LANGUAGE="en",NAME="English",DEFAULT=NO,FORCED=NO,URI="stream_t8f96f2b9eaf5d6164f82c39918f0014d_r167464648.m3u8?useMezzanine=true"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="group_subtitle",LANGUAGE="es",NAME="español",DEFAULT=NO,FORCED=NO,URI="stream_te7c6d5ba55b11cb81e19076afd755e73_r167464740.m3u8?useMezzanine=true"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="group_subtitle",LANGUAGE="fr",NAME="français",DEFAULT=NO,FORCED=NO,URI="stream_td73448b19f67bd05b00fd0e11eed90ce_r167464856.m3u8?useMezzanine=true"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="group_subtitle",LANGUAGE="de",NAME="Deutsch",DEFAULT=NO,FORCED=NO,URI="stream_t1aee2c490809b6532dad9a7ff147f7b7_r167465655.m3u8?useMezzanine=true"
#EXT-X-STREAM-INF:RESOLUTION=854x480,CODECS="avc1.4d401e,mp4a.40.2",BANDWIDTH=4270780,AVERAGE-BANDWIDTH=852036,SCORE=3.0,FRAME-RATE=24.000,AUDIO="group_audio",SUBTITLES="group_subtitle"
stream_t4b706660f393d8c6a8b434529ca06c23_r164818805.m3u8?useMezzanine=true
#EXT-X-STREAM-INF:RESOLUTION=1920x1080,CODECS="avc1.4d4028,mp4a.40.2",BANDWIDTH=12407852,AVERAGE-BANDWIDTH=3555376,SCORE=5.0,FRAME-RATE=24.000,AUDIO="group_audio",SUBTITLES="group_subtitle"
stream_t4b706660f393d8c6a8b434529ca06c23_r164827630.m3u8?useMezzanine=true
#EXT-X-STREAM-INF:RESOLUTION=1280x720,CODECS="avc1.4d401f,mp4a.40.2",BANDWIDTH=8310734,AVERAGE-BANDWIDTH=1600321,SCORE=4.0,FRAME-RATE=24.000,AUDIO="group_audio",SUBTITLES="group_subtitle"
stream_t4b706660f393d8c6a8b434529ca06c23_r164821854.m3u8?useMezzanine=true
#EXT-X-STREAM-INF:RESOLUTION=640x360,CODECS="avc1.4d401e,mp4a.40.2",BANDWIDTH=2111555,AVERAGE-BANDWIDTH=583663,SCORE=2.0,FRAME-RATE=24.000,AUDIO="group_audio",SUBTITLES="group_subtitle"
stream_t4b706660f393d8c6a8b434529ca06c23_r164818138.m3u8?useMezzanine=true
#EXT-X-STREAM-INF:RESOLUTION=426x240,CODECS="avc1.42c015,mp4a.40.2",BANDWIDTH=1149597,AVERAGE-BANDWIDTH=416257,SCORE=1.0,FRAME-RATE=24.000,AUDIO="group_audio",SUBTITLES="group_subtitle"
stream_t4b706660f393d8c6a8b434529ca06c23_r164817876.m3u8?useMezzanine=true
```

### 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: ['-vU', '--skip-download', '--write-sub', '--write-auto-sub', '--sub-lang', 'en', 'https://cloudflarestream.com/OBFUSCATED.G7UQZAseHyrHMQh5kdrBOuWpxnNVlgAHoES043Yjsz8W7v6JPVDjKgh5zXL1Cad6Q8fBjRX4tyz4JACKg2s1PYGyAWk1ttzF1C10k2KeACx4dVZ51WR4NVhZ7EB60k3oCWe5v9RMm3IzNq9WdoJvuSjxE1t9hRGxiSXeF245l1D1WYqSksROtZ0.BZtaYV0R16Y0D_m3QZ7lV5Sperip8fUCKrCNqB0zGMYM3qtU-GOlIFxOu-0185Lmd3u0nN_ok4E_t4zsMRMmiuM4THhBsbG2pdI4748914QZJU3m5-eeCM3f5HC65KGemfiy7i41Da41IVJEtQ9JC6z6DOaf33T5FF3J79W7p6AtAgksr5tv8tFgqs0Nm7G-oHR_diPq9jZJz8kGp3r1wK6373ne2wWUQ_8M2l6L9ywH57nQI55U1961Y5lZyb8HeUyf5a230iY3LpdVLMem3VjEQiIHC1UDyElQu7HJKJa-KW35279K2ib0cy9l7YIR7cqK6uMZ4Y70Q19O18GZbU/manifest/video.m3u8', '-o', 'subtitles.vtt']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.11.16 from yt-dlp/yt-dlp [24f827875]
[debug] Python 3.11.6 (CPython x86_64 64bit) - Linux-6.5.9-arch2-1-x86_64-with-glibc2.38 (OpenSSL 3.1.4 24 Oct 2023, glibc 2.38)
[debug] exe versions: ffmpeg 6.1 (setts), ffprobe 6.1, rtmpdump 2.4
[debug] Optional libraries: certifi-2023.11.17, requests-2.31.0, sqlite3-3.44.2, urllib3-1.26.18
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests
[debug] Loaded 1901 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2023.11.16 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2023.11.16 from yt-dlp/yt-dlp)
[CloudflareStream] Extracting URL: https://cloudflarestream.com/OBFUSCATED.G7UQZAseHyrHMQh5kdrBOuWpxnNVlgAHoES043Yjsz8W7v6JPVDjKgh5zXL1Cad6Q8fBjRX4tyz4JACKg2s1PYGyAWk1ttzF1C10k2KeACx4dVZ51WR4NVhZ7EB60k3oCWe5v9RMm3IzNq9WdoJvuSjxE1t9hRGxiSXeF245l1D1WYqSksROtZ0.BZtaYV0R16Y0D_m3QZ7lV5Sperip8fUCKrCNqB0zGMYM3qtU-GOlIFxOu-0185Lmd3u0nN_ok4E_t4zsMRMmiuM4THhBsbG2pdI4748914QZJU3m5-eeCM3f5HC65KGemfiy7i41Da41IVJEtQ9JC6z6DOaf33T5FF3J79W7p6AtAgksr5tv8tFgqs0Nm7G-oHR_diPq9jZJz8kGp3r1wK6373ne2wWUQ_8M2l6L9ywH57nQI55U1961Y5lZyb8HeUyf5a230iY3LpdVLMem3VjEQiIHC1UDyElQu7HJKJa-KW35279K2ib0cy9l7YIR7cqK6uMZ4Y70Q19O18GZbU/manifest/video.m3u8
[CloudflareStream] 6b618668a51cb59dd4251acbb3cfeb38: Downloading m3u8 information
WARNING: [CloudflareStream] Ignoring subtitle tracks found in the HLS manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
[CloudflareStream] 6b618668a51cb59dd4251acbb3cfeb38: Downloading MPD manifest
WARNING: [CloudflareStream] Ignoring subtitle tracks found in the DASH manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 6b618668a51cb59dd4251acbb3cfeb38: Downloading 1 format(s): hls-3555+dash-164817190
[info] There are no subtitles for the requested languages
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/cloudflarestream.py b/yt_dlp/extractor/cloudflarestream.py
--- a/yt_dlp/extractor/cloudflarestream.py
+++ b/yt_dlp/extractor/cloudflarestream.py
@@ -46,15 +46,18 @@ def _real_extract(self, url):
                 video_id.split('.')[1] + '==='), video_id)['sub']
         manifest_base_url = base_url + 'manifest/video.'
 
-        formats = self._extract_m3u8_formats(
+        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
             manifest_base_url + 'm3u8', video_id, 'mp4',
             'm3u8_native', m3u8_id='hls', fatal=False)
-        formats.extend(self._extract_mpd_formats(
-            manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False))
+        fmts, subs = self._extract_mpd_formats_and_subtitles(
+            manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False)
+        formats.extend(fmts)
+        self._merge_subtitles(subs, target=subtitles)
 
         return {
             'id': video_id,
             'title': video_id,
             'thumbnail': base_url + 'thumbnails/thumbnail.jpg',
             'formats': formats,
+            'subtitles': subtitles,
         }


Test patch: