]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/tf1.py
[megavideozeu] Simplify (Closes #5454)
[yt-dlp.git] / youtube_dl / extractor / tf1.py
CommitLineData
705f6f35 1# coding: utf-8
2da67107 2from __future__ import unicode_literals
705f6f35 3
705f6f35
JMF
4from .common import InfoExtractor
5
2da67107 6
705f6f35 7class TF1IE(InfoExtractor):
0725f584 8 """TF1 uses the wat.tv player."""
382e05fa 9 _VALID_URL = r'http://(?:videos\.tf1|www\.tfou)\.fr/.*?-(?P<id>\d+)(?:-\d+)?\.html'
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': {
2bf098ed 25 'id': '12043945',
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 },
705f6f35
JMF
35 }
36
37 def _real_extract(self, url):
382e05fa 38 video_id = self._match_id(url)
2da67107
JMF
39 webpage = self._download_webpage(url, video_id)
40 embed_url = self._html_search_regex(
b158bb86 41 r'["\'](https?://www.wat.tv/embedframe/.*?)["\']', webpage, 'embed url')
2da67107 42 embed_page = self._download_webpage(embed_url, video_id,
9e1a5b84 43 'Downloading embed player page')
705f6f35 44 wat_id = self._search_regex(r'UVID=(.*?)&', embed_page, 'wat id')
2da67107
JMF
45 wat_info = self._download_json(
46 'http://www.wat.tv/interface/contentv3/%s' % wat_id, video_id)
47 return self.url_result(wat_info['media']['url'], 'Wat')