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\.fr/.*-(?P<id>.*?)\.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,
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group('id')
29 webpage = self._download_webpage(url, video_id)
30 embed_url = self._html_search_regex(
31 r'"(https://www.wat.tv/embedframe/.*?)"', webpage, 'embed url')
32 embed_page = self._download_webpage(embed_url, video_id,
33 'Downloading embed player page')
34 wat_id = self._search_regex(r'UVID=(.*?)&', embed_page, 'wat id')
35 wat_info = self._download_json(
36 'http://www.wat.tv/interface/contentv3/%s' % wat_id, video_id)
37 return self.url_result(wat_info['media']['url'], 'Wat')