1 from .common
import InfoExtractor
9 from .dailymotion
import DailymotionIE
12 class FranceTVBaseInfoExtractor(InfoExtractor
):
13 def _make_url_result(self
, video_or_full_id
, catalog
=None):
14 full_id
= 'francetv:%s' % video_or_full_id
15 if '@' not in video_or_full_id
and catalog
:
16 full_id
+= '@%s' % catalog
17 return self
.url_result(
18 full_id
, ie
=FranceTVIE
.ie_key(),
19 video_id
=video_or_full_id
.split('@')[0])
22 class FranceTVIE(InfoExtractor
):
26 sivideo\.webservices\.francetelevisions\.fr/tools/getInfosOeuvre/v2/\?
27 .*?\bidDiffusion=[^&]+|
29 https?://videos\.francetv\.fr/video/|
32 (?P<id>[^@]+)(?:@(?P<catalog>.+))?
35 _EMBED_REGEX
= [r
'<iframe[^>]+?src=(["\'])(?P
<url
>(?
:https?
://)?embed\
.francetv\
.fr
/\?ue
=.+?
)\
1']
39 'url
': 'https
://sivideo
.webservices
.francetelevisions
.fr
/tools
/getInfosOeuvre
/v2
/?idDiffusion
=162311093&callback
=_jsonp_loader_callback_request_0
',
40 'md5
': 'c2248a8de38c4e65ea8fae7b5df2d84f
',
44 'title
': '13h15
, le dimanche
... - Les mystères de Jésus
',
45 'description
': 'md5
:75efe8d4c0a8205e5904498ffe1e1a42
',
46 'timestamp
': 1502623500,
47 'upload_date
': '20170813',
51 'url
': 'https
://sivideo
.webservices
.francetelevisions
.fr
/tools
/getInfosOeuvre
/v2
/?idDiffusion
=NI_1004933
&catalogue
=Zouzous
&callback
=_jsonp_loader_callback_request_4
',
52 'only_matching
': True,
54 'url
': 'http
://videos
.francetv
.fr
/video
/NI_657393
@Regions',
55 'only_matching
': True,
57 'url
': 'francetv
:162311093',
58 'only_matching
': True,
60 'url
': 'francetv
:NI_1004933
@Zouzous',
61 'only_matching
': True,
63 'url
': 'francetv
:NI_983319
@Info-web
',
64 'only_matching
': True,
66 'url
': 'francetv
:NI_983319
',
67 'only_matching
': True,
69 'url
': 'francetv
:NI_657393
@Regions',
70 'only_matching
': True,
73 'url
': 'francetv
:SIM_France3
',
74 'only_matching
': True,
77 def _extract_video(self, video_id, catalogue=None):
78 # Videos are identified by idDiffusion so catalogue part is optional.
79 # However when provided, some extra formats may be returned so we pass
90 for device_type in ('desktop
', 'mobile
'):
91 dinfo = self._download_json(
92 'https
://player
.webservices
.francetelevisions
.fr
/v1
/videos
/%s' % video_id,
93 video_id, 'Downloading
%s video JSON
' % device_type, query={
94 'device_type
': device_type,
101 video = dinfo.get('video
')
105 duration = video.get('duration
')
107 is_live = video.get('is_live
')
108 if spritesheets is None:
109 spritesheets = video.get('spritesheets
')
111 meta = dinfo.get('meta
')
114 title = meta.get('title
')
115 # XXX: what is meta['pre_title
']?
117 subtitle = meta.get('additional_title
')
119 image = meta.get('image_url
')
120 if timestamp is None:
121 timestamp = parse_iso8601(meta.get('broadcasted_at
'))
126 format_id = video.get('format
')
129 if video.get('workflow
') == 'token
-akamai
':
130 token_url = video.get('token
')
132 token_json = self._download_json(
134 'Downloading signed
%s manifest URL
' % format_id)
136 video_url = token_json.get('url
')
138 video_url = video.get('url
')
140 ext = determine_ext(video_url)
142 formats.extend(self._extract_f4m_formats(
143 video_url, video_id, f4m_id=format_id, fatal=False))
145 fmts, subs = self._extract_m3u8_formats_and_subtitles(
146 video_url, video_id, 'mp4
',
147 entry_protocol='m3u8_native
', m3u8_id=format_id,
150 self._merge_subtitles(subs, target=subtitles)
152 fmts, subs = self._extract_mpd_formats_and_subtitles(
153 video_url, video_id, mpd_id=format_id, fatal=False)
155 self._merge_subtitles(subs, target=subtitles)
156 elif video_url.startswith('rtmp
'):
159 'format_id
': 'rtmp
-%s' % format_id,
163 if self._is_valid_url(video_url, video_id, format_id):
166 'format_id
': format_id,
169 # XXX: what is video['captions
']?
172 if f.get('acodec
') != 'none
' and f.get('language
') in ('qtz
', 'qad
'):
173 f['language_preference
'] = -10
174 f['format_note
'] = 'audio description
%s' % format_field(f, 'format_note
', ', %s')
178 'format_id
': 'spritesheets
',
179 'format_note
': 'storyboard
',
184 'url
': 'about
:invalid
',
187 # XXX: not entirely accurate; each spritesheet seems to be
188 # a 10×10 grid of thumbnails corresponding to approximately
189 # 2 seconds of the video; the last spritesheet may be shorter
191 } for sheet in spritesheets]
195 title += ' - %s' % subtitle
196 title = title.strip()
202 'duration
': duration,
203 'timestamp
': timestamp,
206 'subtitles
': subtitles,
209 def _real_extract(self, url):
210 mobj = self._match_valid_url(url)
211 video_id = mobj.group('id')
212 catalog = mobj.group('catalog
')
216 video_id = qs.get('idDiffusion
', [None])[0]
217 catalog = qs.get('catalogue
', [None])[0]
219 raise ExtractorError('Invalid URL
', expected=True)
221 return self._extract_video(video_id, catalog)
224 class FranceTVSiteIE(FranceTVBaseInfoExtractor):
225 _VALID_URL = r'https?
://(?
:(?
:www\
.)?france\
.tv|mobile\
.france\
.tv
)/(?
:[^
/]+/)*(?P
<id>[^
/]+)\
.html
'
228 'url
': 'https
://www
.france
.tv
/france
-2/13h15
-le
-dimanche
/140921-les
-mysteres
-de
-jesus
.html
',
230 'id': 'ec217ecc
-0733-48cf
-ac06
-af1347b849d1
',
232 'title
': '13h15
, le dimanche
... - Les mystères de Jésus
',
233 'description
': 'md5
:75efe8d4c0a8205e5904498ffe1e1a42
',
234 'timestamp
': 1502623500,
235 'upload_date
': '20170813',
238 'skip_download
': True,
240 'add_ie
': [FranceTVIE.ie_key()],
243 'url
': 'https
://www
.france
.tv
/france
-3/des
-chiffres
-et
-des
-lettres
/139063-emission
-du
-mardi
-9-mai
-2017.html
',
244 'only_matching
': True,
247 'url
': 'https
://www
.france
.tv
/france
-4/hero
-corp
/saison
-1/134151-apres
-le
-calme
.html
',
248 'only_matching
': True,
251 'url
': 'https
://www
.france
.tv
/france
-5/c
-a
-dire
/saison
-10/137013-c
-a
-dire
.html
',
252 'only_matching
': True,
255 'url
': 'https
://www
.france
.tv
/france
-o
/archipels
/132249-mon
-ancetre
-l
-esclave
.html
',
256 'only_matching
': True,
259 'url
': 'https
://www
.france
.tv
/france
-2/direct
.html
',
260 'only_matching
': True,
262 'url
': 'https
://www
.france
.tv
/documentaires
/histoire
/136517-argentine
-les
-500-bebes
-voles
-de
-la
-dictature
.html
',
263 'only_matching
': True,
265 'url
': 'https
://www
.france
.tv
/jeux
-et
-divertissements
/divertissements
/133965-le
-web
-contre
-attaque
.html
',
266 'only_matching
': True,
268 'url
': 'https
://mobile
.france
.tv
/france
-5/c
-dans
-l
-air
/137347-emission
-du
-vendredi
-12-mai
-2017.html
',
269 'only_matching
': True,
271 'url
': 'https
://www
.france
.tv
/142749-rouge
-sang
.html
',
272 'only_matching
': True,
275 'url
': 'https
://www
.france
.tv
/france
-3/direct
.html
',
276 'only_matching
': True,
279 def _real_extract(self, url):
280 display_id = self._match_id(url)
282 webpage = self._download_webpage(url, display_id)
285 video_id = self._search_regex(
286 r'(?
:data
-main
-video\s
*=|videoId
["\']?\s*[:=])\s*(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1',
287 webpage, 'video
id', default=None, group='id')
290 video_id, catalogue = self._html_search_regex(
291 r'(?
:href
=|player\
.setVideo\
(\s
*)"http://videos?\.francetv\.fr/video/([^@]+@[^"]+)"',
292 webpage, 'video ID').split('@')
294 return self._make_url_result(video_id, catalogue)
297 class FranceTVInfoIE(FranceTVBaseInfoExtractor):
298 IE_NAME = 'francetvinfo.fr'
299 _VALID_URL = r'https?://(?:www|mobile|france3-regions)\.francetvinfo\.fr/(?:[^/]+/)*(?P<id>[^/?#&.]+)'
302 'url': 'https://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-jeudi-22-aout-2019_3561461.html',
304 'id': 'd12458ee-5062-48fe-bfdd-a30d6a01b793',
307 'upload_date': '20190822',
308 'timestamp': 1566510900,
309 'description': 'md5:72d167097237701d6e8452ff03b83c00',
315 'skip_download': True,
317 'add_ie': [FranceTVIE.ie_key()],
319 'note': 'Only an image exists in initial webpage instead of the video',
320 'url': 'https://www.francetvinfo.fr/sante/maladie/coronavirus/covid-19-en-inde-une-situation-catastrophique-a-new-dehli_4381095.html',
322 'id': '7d204c9e-a2d3-11eb-9e4c-000d3a23d482',
324 'title': 'Covid-19 : une situation catastrophique à New Dehli',
327 'timestamp': 1619028518,
328 'upload_date': '20210421',
331 'skip_download': True,
333 'add_ie': [FranceTVIE.ie_key()],
335 'url': 'http://www.francetvinfo.fr/elections/europeennes/direct-europeennes-regardez-le-debat-entre-les-candidats-a-la-presidence-de-la-commission_600639.html',
336 'only_matching': True,
338 'url': 'http://www.francetvinfo.fr/economie/entreprises/les-entreprises-familiales-le-secret-de-la-reussite_933271.html',
339 'only_matching': True,
341 'url': 'http://france3-regions.francetvinfo.fr/bretagne/cotes-d-armor/thalassa-echappee-breizh-ce-venredi-dans-les-cotes-d-armor-954961.html',
342 'only_matching': True,
345 'url': 'http://www.francetvinfo.fr/politique/notre-dame-des-landes/video-sur-france-inter-cecile-duflot-denonce-le-regard-meprisant-de-patrick-cohen_1520091.html',
346 'md5': 'ee7f1828f25a648addc90cb2687b1f12',
350 'title': 'NDDL, référendum, Brexit : Cécile Duflot répond à Patrick Cohen',
351 'description': 'Au lendemain de la victoire du "oui
" au référendum sur l\'aéroport de Notre-Dame-des-Landes, l\'ancienne ministre écologiste est l\'invitée de Patrick Cohen. Plus d\'info : https://www.franceinter.fr/emissions/le-7-9/le-7-9-27-juin-2016',
352 'timestamp': 1467011958,
353 'upload_date': '20160627',
354 'uploader': 'France Inter',
355 'uploader_id': 'x2q2ez',
357 'add_ie': ['Dailymotion'],
359 'url': 'http://france3-regions.francetvinfo.fr/limousin/emissions/jt-1213-limousin',
360 'only_matching': True,
362 # "<figure
id=" pattern (#28792)
363 'url': 'https://www.francetvinfo.fr/culture/patrimoine/incendie-de-notre-dame-de-paris/notre-dame-de-paris-de-l-incendie-de-la-cathedrale-a-sa-reconstruction_4372291.html',
364 'only_matching': True,
367 def _real_extract(self, url):
368 display_id = self._match_id(url)
370 webpage = self._download_webpage(url, display_id)
372 dailymotion_urls = tuple(DailymotionIE._extract_embed_urls(url, webpage))
374 return self.playlist_result([
375 self.url_result(dailymotion_url, DailymotionIE.ie_key())
376 for dailymotion_url in dailymotion_urls])
378 video_id = self._search_regex(
379 (r'player\.load[^;]+src:\s*["\']([^
"\']+)',
380 r'id-video=([^@]+@[^"]+)',
381 r'<a
[^
>]+href
="(?:https?:)?//videos\.francetv\.fr/video/([^@]+@[^"]+)"',
382 r'(?:data-id|<figure[^<]+\bid)=["\']([\da
-f
]{8}
-[\da
-f
]{4}
-[\da
-f
]{4}
-[\da
-f
]{4}
-[\da
-f
]{12}
)'),
385 return self._make_url_result(video_id)