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 #22561
  • Loading branch information
gdzx committed Nov 7, 2019
1 parent d64ec12 commit bad5288
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions youtube_dl/extractor/francetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ 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': 'mobile',
'browser': 'firefox',
})

video_url = fallback_info['video']['url']
format_id = fallback_info['video']['format']

formats.extend(self._extract_m3u8_formats(
sign(video_url, format_id), video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id,
fatal=False))

self._sort_formats(formats)

title = info['titre']
Expand Down

0 comments on commit bad5288

Please sign in to comment.