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'https?://(?:(?:videos|www|lci)\.tf1|(?:www\.)?(?:tfou|ushuaiatv|histoire|tvbreizh))\.fr/(?:[^/]+/)*(?P<id>[^/?#.]+)'
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,
22 'expected_warnings': ['HTTP Error 404'],
24 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
26 'id': 'le-grand-mysterioso-chuggington-7085291-739',
28 'title': 'Le grand Mystérioso - Chuggington',
29 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.',
30 'upload_date': '20150103',
33 # Sometimes wat serves the whole file with the --test option
34 'skip_download': True,
36 'skip': 'HTTP Error 410: Gone',
38 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
39 'only_matching': True,
41 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html',
42 'only_matching': True,
44 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
45 'only_matching': True,
48 def _real_extract(self, url):
49 video_id = self._match_id(url)
50 webpage = self._download_webpage(url, video_id)
51 wat_id = self._html_search_regex(
52 r'(["\'])(?:https?:)?//www\.wat\.tv/embedframe/.*?(?P<id>\d{8})\1',
53 webpage, 'wat id', group='id')
54 return self.url_result('wat:%s' % wat_id, 'Wat')