]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/tf1.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class TF1IE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?tf1\.fr/[^/]+/(?P<program_slug>[^/]+)/videos/(?P<id>[^/?&#]+)\.html'
17 'url': 'https://www.tf1.fr/tmc/quotidien-avec-yann-barthes/videos/quotidien-premiere-partie-11-juin-2019.html',
21 'title': 'md5:f392bc52245dc5ad43771650c96fb620',
22 'description': 'md5:a02cdb217141fb2d469d6216339b052f',
23 'upload_date': '20190611',
24 'timestamp': 1560273989,
26 'series': 'Quotidien avec Yann Barthès',
27 'tags': ['intégrale', 'quotidien', 'Replay'],
30 # Sometimes wat serves the whole file with the --test option
31 'skip_download': True,
34 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
35 'only_matching': True,
37 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
38 'only_matching': True,
41 def _real_extract(self
, url
):
42 program_slug
, slug
= self
._match
_valid
_url
(url
).groups()
43 video
= self
._download
_json
(
44 'https://www.tf1.fr/graphql/web', slug
, query
={
45 'id': '9b80783950b85247541dd1d851f9cc7fa36574af015621f853ab111a679ce26f',
46 'variables': json
.dumps({
47 'programSlug': program_slug
,
50 })['data']['videoBySlug']
51 wat_id
= video
['streamId']
54 for tag
in (video
.get('tags') or []):
55 label
= tag
.get('label')
60 decoration
= video
.get('decoration') or {}
63 for source
in (try_get(decoration
, lambda x
: x
['image']['sources'], list) or []):
64 source_url
= source
.get('url')
69 'width': int_or_none(source
.get('width')),
73 '_type': 'url_transparent',
75 'url': 'wat:' + wat_id
,
76 'title': video
.get('title'),
77 'thumbnails': thumbnails
,
78 'description': decoration
.get('description'),
79 'timestamp': parse_iso8601(video
.get('date')),
80 'duration': int_or_none(try_get(video
, lambda x
: x
['publicPlayingInfos']['duration'])),
82 'series': decoration
.get('programLabel'),
83 'season_number': int_or_none(video
.get('season')),
84 'episode_number': int_or_none(video
.get('episode')),