Skip to content

Commit

Permalink
[francetv] Add fallback video url extraction
Browse files Browse the repository at this point in the history
Fallback on another API endpoint when no video formats are found.

Closes ytdl-org#22561
  • Loading branch information
gdzx committed Nov 17, 2020
1 parent cb2b9a2 commit dd6acc8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions youtube_dl/extractor/francetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit dd6acc8

Please sign in to comment.