+ formats = []
+ for video in info['videos']:
+ if video['statut'] != 'ONLINE':
+ continue
+ video_url = video['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) or '/live.francetv.fr/' in video_url
+ format_id = video['format']
+ ext = determine_ext(video_url)
+ if ext == 'f4m':
+ if georestricted:
+ # See https://github.com/rg3/youtube-dl/issues/3963
+ # m3u8 urls work fine
+ continue
+ formats.extend(self._extract_f4m_formats(
+ sign(video_url, format_id) + '&hdcore=3.7.0&plugin=aasp-3.7.0.39.44',
+ video_id, f4m_id=format_id, fatal=False))
+ elif ext == 'm3u8':
+ formats.extend(self._extract_m3u8_formats(
+ sign(video_url, format_id), video_id, 'mp4',
+ entry_protocol='m3u8_native', m3u8_id=format_id,
+ fatal=False))
+ elif video_url.startswith('rtmp'):
+ formats.append({
+ 'url': video_url,
+ 'format_id': 'rtmp-%s' % format_id,
+ 'ext': 'flv',
+ })
+ else:
+ if self._is_valid_url(video_url, video_id, format_id):
+ formats.append({
+ 'url': video_url,
+ 'format_id': format_id,
+ })
+ self._sort_formats(formats)
+
+ title = info['titre']
+ subtitle = info.get('sous_titre')
+ if subtitle:
+ title += ' - %s' % subtitle
+ title = title.strip()
+
+ subtitles = {}
+ subtitles_list = [{
+ 'url': subformat['url'],
+ 'ext': subformat.get('format'),
+ } for subformat in info.get('subtitles', []) if subformat.get('url')]
+ if subtitles_list:
+ subtitles['fr'] = subtitles_list
+
+ 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']),
+ 'is_live': is_live,
+ 'formats': formats,
+ 'subtitles': subtitles,
+ }