mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 10:11:52 +00:00
[francetv] improve info extraction
This commit is contained in:
parent
8a6c5b0806
commit
d65628ef03
1 changed files with 12 additions and 11 deletions
|
@ -17,6 +17,7 @@ from ..utils import (
|
||||||
parse_duration,
|
parse_duration,
|
||||||
try_get,
|
try_get,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
from .dailymotion import DailymotionIE
|
from .dailymotion import DailymotionIE
|
||||||
|
|
||||||
|
@ -130,10 +131,10 @@ class FranceTVIE(InfoExtractor):
|
||||||
|
|
||||||
videos = []
|
videos = []
|
||||||
|
|
||||||
for video in info['videos']:
|
for video in (info.get('videos') or []):
|
||||||
if video['statut'] != 'ONLINE':
|
if video.get('statut') != 'ONLINE':
|
||||||
continue
|
continue
|
||||||
if not video['url']:
|
if not video.get('url'):
|
||||||
continue
|
continue
|
||||||
videos.append(video)
|
videos.append(video)
|
||||||
|
|
||||||
|
@ -151,15 +152,15 @@ class FranceTVIE(InfoExtractor):
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for video in videos:
|
for video in videos:
|
||||||
video_url = video['url']
|
video_url = video.get('url')
|
||||||
if not video_url:
|
if not video_url:
|
||||||
continue
|
continue
|
||||||
if is_live is None:
|
if is_live is None:
|
||||||
is_live = ((try_get(
|
is_live = (try_get(
|
||||||
video, lambda x: x['plages_ouverture'][0]['direct'], bool) is True)
|
video, lambda x: x['plages_ouverture'][0]['direct'], bool) is True
|
||||||
or video.get('is_live') is True
|
or video.get('is_live') is True
|
||||||
or '/live.francetv.fr/' in video_url)
|
or '/live.francetv.fr/' in video_url)
|
||||||
format_id = video['format']
|
format_id = video.get('format')
|
||||||
ext = determine_ext(video_url)
|
ext = determine_ext(video_url)
|
||||||
if ext == 'f4m':
|
if ext == 'f4m':
|
||||||
if georestricted:
|
if georestricted:
|
||||||
|
@ -209,10 +210,10 @@ class FranceTVIE(InfoExtractor):
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': self._live_title(title) if is_live else title,
|
||||||
'description': clean_html(info['synopsis']),
|
'description': clean_html(info.get('synopsis')),
|
||||||
'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', info['image']),
|
'thumbnail': urljoin('http://pluzz.francetv.fr', info.get('image')),
|
||||||
'duration': int_or_none(info.get('real_duration')) or parse_duration(info['duree']),
|
'duration': int_or_none(info.get('real_duration')) or parse_duration(info.get('duree')),
|
||||||
'timestamp': int_or_none(info['diffusion']['timestamp']),
|
'timestamp': int_or_none(try_get(info, lambda x: x['diffusion']['timestamp'])),
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
|
|
Loading…
Reference in a new issue