2 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class TF1IE(InfoExtractor):
10 """TF1 uses the wat.tv player."""
11 _VALID_URL = r'http://(?:videos\.tf1|www\.tfou)\.fr/.*?-(?P<id>\d+)(?:-\d+)?\.html'
13 'url': 'http://videos.tf1.fr/auto-moto/citroen-grand-c4-picasso-2013-presentation-officielle-8062060.html',
17 'title': 'Citroën Grand C4 Picasso 2013 : présentation officielle',
18 'description': 'Vidéo officielle du nouveau Citroën Grand C4 Picasso, lancé à l\'automne 2013.',
21 # Sometimes wat serves the whole file with the --test option
22 'skip_download': True,
25 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
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,
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
41 webpage = self._download_webpage(url, video_id)
42 embed_url = self._html_search_regex(
43 r'["\'](https?://www.wat.tv/embedframe/.*?)["\']', webpage, 'embed url')
44 embed_page = self._download_webpage(embed_url, video_id,
45 'Downloading embed player page')
46 wat_id = self._search_regex(r'UVID=(.*?)&', embed_page, 'wat id')
47 wat_info = self._download_json(
48 'http://www.wat.tv/interface/contentv3/%s' % wat_id, video_id)
49 return self.url_result(wat_info['media']['url'], 'Wat')