1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class WatIE(InfoExtractor
):
12 _VALID_URL
= r
'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P<id>[0-9a-z]+)'
16 'url': 'http://www.wat.tv/video/soupe-figues-l-orange-aux-epices-6z1uz_2hvf7_.html',
20 'title': 'Soupe de figues à l\'orange et aux épices',
21 'description': 'Retrouvez l\'émission "Petits plats en équilibre", diffusée le 18 août 2014.',
22 'upload_date': '20140819',
27 'skip_download': True,
29 'expected_warnings': ['HTTP Error 404'],
30 'skip': 'This content is no longer available',
33 'url': 'http://www.wat.tv/video/gregory-lemarchal-voix-ange-6z1v7_6ygkj_.html',
34 'md5': 'b16574df2c3cd1a36ca0098f2a791925',
38 'title': 'Grégory Lemarchal, une voix d\'ange depuis 10 ans (1/3)',
39 'upload_date': '20140816',
41 'expected_warnings': ["Ce contenu n'est pas disponible pour l'instant."],
42 'skip': 'This content is no longer available',
47 def _real_extract(self
, url
):
48 video_id
= self
._match
_id
(url
)
49 video_id
= video_id
if video_id
.isdigit() and len(video_id
) > 6 else compat_str(int(video_id
, 36))
51 # 'contentv4' is used in the website, but it also returns the related
52 # videos, we don't need them
53 # video_data = self._download_json(
54 # 'http://www.wat.tv/interface/contentv4s/' + video_id, video_id)
55 video_data
= self
._download
_json
(
56 'https://mediainfo.tf1.fr/mediainfocombo/' + video_id
,
57 video_id
, query
={'context': 'MYTF1', 'pver': '4020003'}
)
58 video_info
= video_data
['media']
60 error_desc
= video_info
.get('error_desc')
62 if video_info
.get('error_code') == 'GEOBLOCKED':
63 self
.raise_geo_restricted(error_desc
, video_info
.get('geoList'))
64 raise ExtractorError(error_desc
, expected
=True)
66 title
= video_info
['title']
71 def extract_formats(manifest_urls
):
72 for f
, f_url
in manifest_urls
.items():
75 if f
in ('dash', 'mpd'):
76 fmts
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(
77 f_url
.replace('://das-q1.tf1.fr/', '://das-q1-ssl.tf1.fr/'),
78 video_id
, mpd_id
='dash', fatal
=False)
80 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
81 f_url
, video_id
, 'mp4',
82 'm3u8_native', m3u8_id
='hls', fatal
=False)
86 self
._merge
_subtitles
(subs
, target
=subtitles
)
88 delivery
= video_data
.get('delivery') or {}
89 extract_formats({delivery.get('format'): delivery.get('url')}
)
91 if delivery
.get('drm'):
92 self
.report_drm(video_id
)
93 manifest_urls
= self
._download
_json
(
94 'http://www.wat.tv/get/webhtml/' + video_id
, video_id
, fatal
=False)
96 extract_formats(manifest_urls
)
101 'thumbnail': video_info
.get('preview'),
102 'upload_date': unified_strdate(try_get(
103 video_data
, lambda x
: x
['mediametrie']['chapters'][0]['estatS4'])),
104 'duration': int_or_none(video_info
.get('duration')),
106 'subtitles': subtitles
,