]>
Commit | Line | Data |
---|---|---|
705f6f35 | 1 | # coding: utf-8 |
2da67107 | 2 | from __future__ import unicode_literals |
705f6f35 | 3 | |
705f6f35 JMF |
4 | from .common import InfoExtractor |
5 | ||
2da67107 | 6 | |
705f6f35 | 7 | class TF1IE(InfoExtractor): |
0725f584 | 8 | """TF1 uses the wat.tv player.""" |
db3b8b21 | 9 | _VALID_URL = r'https?://(?:(?:videos|www|lci)\.tf1|(?:www\.)?(?:tfou|ushuaiatv|histoire|tvbreizh))\.fr/(?:[^/]+/)*(?P<id>[^/?#.]+)' |
42833b44 | 10 | _TESTS = [{ |
2da67107 JMF |
11 | 'url': 'http://videos.tf1.fr/auto-moto/citroen-grand-c4-picasso-2013-presentation-officielle-8062060.html', |
12 | 'info_dict': { | |
13 | 'id': '10635995', | |
14 | 'ext': 'mp4', | |
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.', | |
17 | }, | |
18 | 'params': { | |
19 | # Sometimes wat serves the whole file with the --test option | |
20 | 'skip_download': True, | |
fa800269 | 21 | }, |
382e05fa | 22 | }, { |
23 | 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html', | |
24 | 'info_dict': { | |
ad1b6017 | 25 | 'id': 'le-grand-mysterioso-chuggington-7085291-739', |
382e05fa | 26 | 'ext': 'mp4', |
27 | 'title': 'Le grand Mystérioso - Chuggington', | |
2bf098ed | 28 | 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.', |
29 | 'upload_date': '20150103', | |
382e05fa | 30 | }, |
31 | 'params': { | |
32 | # Sometimes wat serves the whole file with the --test option | |
33 | 'skip_download': True, | |
34 | }, | |
ad1b6017 | 35 | 'skip': 'HTTP Error 410: Gone', |
42833b44 YCH |
36 | }, { |
37 | 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html', | |
38 | 'only_matching': True, | |
e6e63e91 S |
39 | }, { |
40 | 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html', | |
41 | 'only_matching': True, | |
05467d5a S |
42 | }, { |
43 | 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html', | |
44 | 'only_matching': True, | |
42833b44 | 45 | }] |
705f6f35 JMF |
46 | |
47 | def _real_extract(self, url): | |
382e05fa | 48 | video_id = self._match_id(url) |
2da67107 | 49 | webpage = self._download_webpage(url, video_id) |
d7ffcfcf | 50 | wat_id = self._html_search_regex( |
22b7ac13 | 51 | r'(["\'])(?:https?:)?//www\.wat\.tv/embedframe/.*?(?P<id>\d{8})\1', |
d7ffcfcf | 52 | webpage, 'wat id', group='id') |
6212bcb1 | 53 | return self.url_result('wat:%s' % wat_id, 'Wat') |