]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tf1.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
7 class TF1IE(InfoExtractor
):
8 """TF1 uses the wat.tv player."""
9 _VALID_URL
= r
'http://(?:(?:videos|www|lci)\.tf1|www\.tfou)\.fr/.*?-(?P<id>\d+)(?:-\d+)?\.html'
11 'url': 'http://videos.tf1.fr/auto-moto/citroen-grand-c4-picasso-2013-presentation-officielle-8062060.html',
15 'title': 'Citroën Grand C4 Picasso 2013 : présentation officielle',
16 'description': 'Vidéo officielle du nouveau Citroën Grand C4 Picasso, lancé à l\'automne 2013.',
19 # Sometimes wat serves the whole file with the --test option
20 'skip_download': True,
23 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
27 'title': 'Le grand Mystérioso - Chuggington',
28 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.',
29 'upload_date': '20150103',
32 # Sometimes wat serves the whole file with the --test option
33 'skip_download': True,
36 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
37 'only_matching': True,
39 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html',
40 'only_matching': True,
43 def _real_extract(self
, url
):
44 video_id
= self
._match
_id
(url
)
45 webpage
= self
._download
_webpage
(url
, video_id
)
46 embed_url
= self
._html
_search
_regex
(
47 r
'["\'](https?
://www
.wat
.tv
/embedframe
/.*?
)["\']', webpage, 'embed url')
48 embed_page = self._download_webpage(embed_url, video_id,
49 'Downloading embed player page')
50 wat_id = self._search_regex(r'UVID=(.*?)&', embed_page, 'wat id')
51 wat_info = self._download_json(
52 'http://www.wat.tv/interface/contentv3/%s' % wat_id, video_id)
53 return self.url_result(wat_info['media']['url'], 'Wat')