diff options
author | Remita Amine <remitamine@gmail.com> | 2020-11-17 23:16:04 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2020-11-17 23:16:04 +0100 |
commit | d65628ef037c5c927cf2990d91f30cc222724171 (patch) | |
tree | 322db185b372d2a0e8b4dc461f37b7a9a3858702 /youtube_dl/extractor/francetv.py | |
parent | 8a6c5b080600465e08f5504f147c9042211c123b (diff) | |
download | youtube-dl-d65628ef037c5c927cf2990d91f30cc222724171.tar.xz |
[francetv] improve info extraction
Diffstat (limited to 'youtube_dl/extractor/francetv.py')
-rw-r--r-- | youtube_dl/extractor/francetv.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py index d776cf1dd..92f0851e3 100644 --- a/youtube_dl/extractor/francetv.py +++ b/youtube_dl/extractor/francetv.py @@ -17,6 +17,7 @@ from ..utils import ( parse_duration, try_get, url_or_none, + urljoin, ) from .dailymotion import DailymotionIE @@ -130,10 +131,10 @@ class FranceTVIE(InfoExtractor): videos = [] - for video in info['videos']: - if video['statut'] != 'ONLINE': + for video in (info.get('videos') or []): + if video.get('statut') != 'ONLINE': continue - if not video['url']: + if not video.get('url'): continue videos.append(video) @@ -151,15 +152,15 @@ class FranceTVIE(InfoExtractor): formats = [] for video in videos: - video_url = video['url'] + video_url = video.get('url') if not video_url: continue if is_live is None: - is_live = ((try_get( - video, lambda x: x['plages_ouverture'][0]['direct'], bool) is True) + is_live = (try_get( + video, lambda x: x['plages_ouverture'][0]['direct'], bool) is True or video.get('is_live') is True or '/live.francetv.fr/' in video_url) - format_id = video['format'] + format_id = video.get('format') ext = determine_ext(video_url) if ext == 'f4m': if georestricted: @@ -209,10 +210,10 @@ class FranceTVIE(InfoExtractor): return { 'id': video_id, 'title': self._live_title(title) if is_live else title, - 'description': clean_html(info['synopsis']), - 'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', info['image']), - 'duration': int_or_none(info.get('real_duration')) or parse_duration(info['duree']), - 'timestamp': int_or_none(info['diffusion']['timestamp']), + 'description': clean_html(info.get('synopsis')), + 'thumbnail': urljoin('http://pluzz.francetv.fr', info.get('image')), + 'duration': int_or_none(info.get('real_duration')) or parse_duration(info.get('duree')), + 'timestamp': int_or_none(try_get(info, lambda x: x['diffusion']['timestamp'])), 'is_live': is_live, 'formats': formats, 'subtitles': subtitles, |