From dd6acc8a10796d7c19ced46b85466f4e4136df09 Mon Sep 17 00:00:00 2001 From: gdzx Date: Wed, 6 Nov 2019 19:55:13 +0100 Subject: [PATCH] [francetv] Add fallback video url extraction Fallback on another API endpoint when no video formats are found. Closes ytdl-org#22561 --- youtube_dl/extractor/francetv.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py index 81b468c7d1e..ac42102e9aa 100644 --- a/youtube_dl/extractor/francetv.py +++ b/youtube_dl/extractor/francetv.py @@ -166,6 +166,21 @@ def sign(manifest_url, manifest_id): 'url': video_url, 'format_id': format_id, }) + + if not formats: + fallback_info = self._download_json( + 'https://player.webservices.francetelevisions.fr/v1/videos/%s' % video_id, + video_id, 'Downloading fallback video JSON', query={ + 'device_type': 'desktop', + 'browser': 'ytdl', + }) + + video_url = fallback_info['video']['url'] + format_id = fallback_info['video']['format'] + + formats.extend(self._extract_mpd_formats( + sign(video_url, format_id), video_id, mpd_id='dash', fatal=False)) + self._sort_formats(formats) title = info['titre']