]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tf1.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
8 class TF1IE(InfoExtractor
):
9 """TF1 uses the wat.tv player."""
10 _VALID_URL
= r
'https?://(?:(?:videos|www|lci)\.tf1|(?:www\.)?(?:tfou|ushuaiatv|histoire|tvbreizh))\.fr/(?:[^/]+/)*(?P<id>[^/?#.]+)'
12 'url': 'http://videos.tf1.fr/auto-moto/citroen-grand-c4-picasso-2013-presentation-officielle-8062060.html',
16 'title': 'Citroën Grand C4 Picasso 2013 : présentation officielle',
17 'description': 'Vidéo officielle du nouveau Citroën Grand C4 Picasso, lancé à l\'automne 2013.',
20 # Sometimes wat serves the whole file with the --test option
21 'skip_download': True,
23 'expected_warnings': ['HTTP Error 404'],
25 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
27 'id': 'le-grand-mysterioso-chuggington-7085291-739',
29 'title': 'Le grand Mystérioso - Chuggington',
30 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.',
31 'upload_date': '20150103',
34 # Sometimes wat serves the whole file with the --test option
35 'skip_download': True,
37 'skip': 'HTTP Error 410: Gone',
39 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
40 'only_matching': True,
42 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html',
43 'only_matching': True,
45 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
46 'only_matching': True,
48 'url': 'https://www.tf1.fr/tmc/quotidien-avec-yann-barthes/videos/quotidien-premiere-partie-11-juin-2019.html',
52 'title': 'md5:f392bc52245dc5ad43771650c96fb620',
53 'description': 'md5:44bc54f0a21322f5b91d68e76a544eae',
54 'upload_date': '20190611',
57 # Sometimes wat serves the whole file with the --test option
58 'skip_download': True,
62 def _real_extract(self
, url
):
63 video_id
= self
._match
_id
(url
)
65 webpage
= self
._download
_webpage
(url
, video_id
)
69 data
= self
._parse
_json
(
71 r
'__APOLLO_STATE__\s*=\s*({.+?})\s*(?:;|</script>)', webpage
,
72 'data', default
='{}'), video_id
, fatal
=False)
78 for key
, video
in data
.items()
79 if isinstance(video
, dict)
80 and video
.get('slug') == video_id
)
81 if not isinstance(wat_id
, compat_str
) or not wat_id
.isdigit():
87 wat_id
= self
._html
_search
_regex
(
88 (r
'(["\'])(?
:https?
:)?
//www\
.wat\
.tv
/embedframe
/.*?
(?P
<id>\d{8}
)\
1',
89 r'(["\']?)streamId\1\s*:\s*(["\']?
)(?P
<id>\d
+)\
2'),
90 webpage, 'wat
id', group='id')
92 return self.url_result('wat
:%s' % wat_id, 'Wat
')