Repository: yt-dlp/yt-dlp

Issue:
TV5MondePlus: Download subtitles
### Checklist

- [X] I'm requesting a site-specific feature
- [X] I've verified that I'm running yt-dlp version **2022.06.22.1** ([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 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

Europe

### Example URLs

https://revoir.tv5monde.com/toutes-les-videos/series-fictions/l-art-du-crime-un-coeur-de-pierre

### Description

When playing the stream in the browser, I can request subtitles.
However yt-dlp does not detect them.

![image](https://user-images.githubusercontent.com/43293037/175953403-92fd33f9-9f99-4715-ae9d-d48b5a95f9c9.png)


### Verbose log

```shell
[debug] Command-line config: ['-vU', '--all-subs', 'https://revoir.tv5monde.com/toutes-les-videos/series-fictions/l-art-du-crime-un-coeur-de-pierre']
[debug] User config "/home/frank/.config/yt-dlp/config": ['--all-subs', '--convert-subs=srt', '-k', '--write-annotations', '--write-info-json', '--write-description', '--compat-options', 'filename']
[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.06.22.1 [a86e01e]
[debug] Compatibility options: filename
[debug] Python version 3.10.4 (CPython 64bit) - Linux-5.15.0-39-generic-x86_64-with-glibc2.35
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.11.0, brotli-1.0.9, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, secretstorage-3.3.1, sqlite3-2.6.0, websockets-9.1
[debug] Proxy map: {}
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.06.22.1, Current version: 2022.06.22.1
yt-dlp is up to date (2022.06.22.1)
[debug] [TV5MondePlus] Extracting URL: https://revoir.tv5monde.com/toutes-les-videos/series-fictions/l-art-du-crime-un-coeur-de-pierre
[TV5MondePlus] l-art-du-crime-un-coeur-de-pierre: Downloading webpage
[TV5MondePlus] l-art-du-crime-un-coeur-de-pierre: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 0d1de55b-40a2-5635-c2a2-77c4c5e225b1: Downloading 1 format(s): hls-2485+hls-259
[info] Writing video description to: Un coeur de pierre S5EP1_2-0d1de55b-40a2-5635-c2a2-77c4c5e225b1.description
[info] Writing video metadata as JSON to: Un coeur de pierre S5EP1_2-0d1de55b-40a2-5635-c2a2-77c4c5e225b1.info.json
WARNING: There are no annotations to write.
[SubtitlesConvertor] There aren't any subtitles to convert
[debug] Invoking hlsnative downloader on "https://msod.tv5monde.com/tv5monde/vod/assets/106982361_6D4BA7b/materials/N8JxIH05Nk_6D4BA7b/vod-idx.ism/vod-idx-video=2100000.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 734

etc.
at the end, no subtitles are present.

yt-dlp -J does not list subtitles:
"requested_subtitles": null,
```



Discussion:
Can u provide a link that has subs and is not region blocked?
The link I provided plays with subtitles in the browser, see the screenshot.

I'm not sure if TV5Monde does have a streaming site that is not geo-restricted. I'm accessing from Germany, this is OK.
I found the subtitle at
https://dl-revoir.tv5monde.com/subtitles/02/5742484_FRA_FRA.webvtt
And there are even more at
https://dl-revoir.tv5monde.com/subtitles/02/5742484_FRA_ENG.webvtt
https://dl-revoir.tv5monde.com/subtitles/02/5742484_FRA_GER.webvtt
https://dl-revoir.tv5monde.com/subtitles/02/5742484_FRA_RUS.webvtt
although I cannot see a way to select them in the webplayer.

I saw the languages listed at https://europe.tv5monde.com/de/tv-programm/series/l-art-du-crime/un-coeur-de-pierre-694226
and just gave it a try…

Resolving patch:
diff --git a/yt_dlp/extractor/tv5mondeplus.py b/yt_dlp/extractor/tv5mondeplus.py
--- a/yt_dlp/extractor/tv5mondeplus.py
+++ b/yt_dlp/extractor/tv5mondeplus.py
@@ -84,6 +84,13 @@ class TV5MondePlusIE(InfoExtractor):
     }]
     _GEO_BYPASS = False
 
+    @staticmethod
+    def _extract_subtitles(data_captions):
+        subtitles = {}
+        for f in traverse_obj(data_captions, ('files', lambda _, v: url_or_none(v['file']))):
+            subtitles.setdefault(f.get('label') or 'fra', []).append({'url': f['file']})
+        return subtitles
+
     def _real_extract(self, url):
         display_id = self._match_id(url)
         webpage = self._download_webpage(url, display_id)
@@ -176,6 +183,8 @@ def process_video_files(v):
             'duration': duration,
             'upload_date': upload_date,
             'formats': formats,
+            'subtitles': self._extract_subtitles(self._parse_json(
+                traverse_obj(vpl_data, ('data-captions', {str}), default='{}'), display_id, fatal=False)),
             'series': series,
             'episode': episode,
         }


Test patch: