]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/rtvnh.py
1 from .common
import InfoExtractor
2 from ..utils
import ExtractorError
5 class RTVNHIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?rtvnh\.nl/video/(?P<id>[0-9]+)'
8 'url': 'http://www.rtvnh.nl/video/131946',
9 'md5': 'cdbec9f44550763c8afc96050fa747dc',
13 'title': 'Grote zoektocht in zee bij Zandvoort naar vermiste vrouw',
14 'thumbnail': r
're:^https?:.*\.jpg$'
18 def _real_extract(self
, url
):
19 video_id
= self
._match
_id
(url
)
21 meta
= self
._parse
_json
(self
._download
_webpage
(
22 'http://www.rtvnh.nl/video/json?m=' + video_id
, video_id
), video_id
)
24 status
= meta
.get('status')
27 '%s returned error code %d' % (self
.IE_NAME
, status
), expected
=True)
30 rtmp_formats
= self
._extract
_smil
_formats
(
31 'http://www.rtvnh.nl/video/smil?m=' + video_id
, video_id
)
32 formats
.extend(rtmp_formats
)
34 for rtmp_format
in rtmp_formats
:
35 rtmp_url
= '%s/%s' % (rtmp_format
['url'], rtmp_format
['play_path'])
36 rtsp_format
= rtmp_format
.copy()
37 del rtsp_format
['play_path']
38 del rtsp_format
['ext']
40 'format_id': rtmp_format
['format_id'].replace('rtmp', 'rtsp'),
41 'url': rtmp_url
.replace('rtmp://', 'rtsp://'),
44 formats
.append(rtsp_format
)
45 http_base_url
= rtmp_url
.replace('rtmp://', 'http://')
46 formats
.extend(self
._extract
_m
3u8_formats
(
47 http_base_url
+ '/playlist.m3u8', video_id
, 'mp4',
48 'm3u8_native', m3u8_id
='hls', fatal
=False))
49 formats
.extend(self
._extract
_f
4m
_formats
(
50 http_base_url
+ '/manifest.f4m',
51 video_id
, f4m_id
='hds', fatal
=False))
55 'title': meta
['title'].strip(),
56 'thumbnail': meta
.get('image'),