]>
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,
32 'format': 'bestvideo',
35 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
36 'only_matching': True,
38 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
39 'only_matching': True,
42 def _real_extract(self
, url
):
43 program_slug
, slug
= self
._match
_valid
_url
(url
).groups()
44 video
= self
._download
_json
(
45 'https://www.tf1.fr/graphql/web', slug
, query
={
46 'id': '9b80783950b85247541dd1d851f9cc7fa36574af015621f853ab111a679ce26f',
47 'variables': json
.dumps({
48 'programSlug': program_slug
,
51 })['data']['videoBySlug']
52 wat_id
= video
['streamId']
55 for tag
in (video
.get('tags') or []):
56 label
= tag
.get('label')
61 decoration
= video
.get('decoration') or {}
64 for source
in (try_get(decoration
, lambda x
: x
['image']['sources'], list) or []):
65 source_url
= source
.get('url')
70 'width': int_or_none(source
.get('width')),
74 '_type': 'url_transparent',
76 'url': 'wat:' + wat_id
,
77 'title': video
.get('title'),
78 'thumbnails': thumbnails
,
79 'description': decoration
.get('description'),
80 'timestamp': parse_iso8601(video
.get('date')),
81 'duration': int_or_none(try_get(video
, lambda x
: x
['publicPlayingInfos']['duration'])),
83 'series': decoration
.get('programLabel'),
84 'season_number': int_or_none(video
.get('season')),
85 'episode_number': int_or_none(video
.get('episode')),