]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/rtvnh.py
[rtvnh] Make SMIL not fatal
[yt-dlp.git] / youtube_dl / extractor / rtvnh.py
CommitLineData
f0f3a6c9 1# coding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
5
6
d9ab5262 7class RTVNHIE(InfoExtractor):
f0f3a6c9 8 _VALID_URL = r'https?://(?:www\.)?rtvnh\.nl/video/(?P<id>[0-9]+)'
9 _TEST = {
f0f3a6c9 10 'url': 'http://www.rtvnh.nl/video/131946',
11 'md5': '6e1d0ab079e2a00b6161442d3ceacfc1',
12 'info_dict': {
13 'id': '131946',
14 'ext': 'mp4',
15 'title': 'Grote zoektocht in zee bij Zandvoort naar vermiste vrouw',
d9ab5262 16 'thumbnail': 're:^https?:.*\.jpg$'
f0f3a6c9 17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
240ca32e
S
22
23 meta = self._parse_json(self._download_webpage(
24 'http://www.rtvnh.nl/video/json?m=' + video_id, video_id), video_id)
25 formats = self._extract_smil_formats(
60231c65 26 'http://www.rtvnh.nl/video/smil?m=' + video_id, video_id, fatal=False)
f0f3a6c9 27
28 for item in meta['source']['fb']:
29 if item.get('type') == 'hls':
240ca32e
S
30 formats.extend(self._extract_m3u8_formats(
31 item['file'], video_id, ext='mp4', entry_protocol='m3u8_native'))
f0f3a6c9 32 elif item.get('type') == '':
33 formats.append({'url': item['file']})
34
35 return {
36 'id': video_id,
37 'title': meta['title'].strip(),
f1960478 38 'thumbnail': meta.get('image'),
f0f3a6c9 39 'formats': formats
40 }