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