]>
Commit | Line | Data |
---|---|---|
6493f5d7 JMF |
1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | ||
5 | from .common import InfoExtractor | |
7adcbe75 | 6 | from ..utils import parse_duration |
6493f5d7 JMF |
7 | |
8 | ||
9 | class RtlXlIE(InfoExtractor): | |
10 | IE_NAME = 'rtlxl.nl' | |
bdf80aa5 | 11 | _VALID_URL = r'https?://(www\.)?rtlxl\.nl/#!/[^/]+/(?P<uuid>[^/?]+)' |
6493f5d7 JMF |
12 | |
13 | _TEST = { | |
14 | 'url': 'http://www.rtlxl.nl/#!/rtl-nieuws-132237/6e4203a6-0a5e-3596-8424-c599a59e0677', | |
de2d9f5f | 15 | 'md5': 'cc16baa36a6c169391f0764fa6b16654', |
6493f5d7 JMF |
16 | 'info_dict': { |
17 | 'id': '6e4203a6-0a5e-3596-8424-c599a59e0677', | |
de2d9f5f | 18 | 'ext': 'mp4', |
6493f5d7 | 19 | 'title': 'RTL Nieuws - Laat', |
de2d9f5f | 20 | 'description': 'md5:6b61f66510c8889923b11f2778c72dc5', |
6493f5d7 JMF |
21 | 'timestamp': 1408051800, |
22 | 'upload_date': '20140814', | |
7adcbe75 | 23 | 'duration': 576.880, |
6493f5d7 | 24 | }, |
6493f5d7 JMF |
25 | } |
26 | ||
27 | def _real_extract(self, url): | |
28 | mobj = re.match(self._VALID_URL, url) | |
29 | uuid = mobj.group('uuid') | |
30 | ||
31 | info = self._download_json( | |
49f0da7a | 32 | 'http://www.rtl.nl/system/s4m/vfd/version=2/uuid=%s/fmt=flash/' % uuid, |
6493f5d7 | 33 | uuid) |
7adcbe75 | 34 | |
6493f5d7 JMF |
35 | material = info['material'][0] |
36 | episode_info = info['episodes'][0] | |
37 | ||
6493f5d7 JMF |
38 | progname = info['abstracts'][0]['name'] |
39 | subtitle = material['title'] or info['episodes'][0]['name'] | |
40 | ||
49f0da7a NJ |
41 | # Use unencrypted m3u8 streams (See https://github.com/rg3/youtube-dl/issues/4118) |
42 | videopath = material['videopath'].replace('.f4m', '.m3u8') | |
37eddd31 | 43 | m3u8_url = 'http://manifest.us.rtl.nl' + videopath |
de2d9f5f | 44 | |
37eddd31 | 45 | formats = self._extract_m3u8_formats(m3u8_url, uuid, ext='mp4') |
de2d9f5f | 46 | |
4698b14b | 47 | video_urlpart = videopath.split('/flash/')[1][:-5] |
de2d9f5f S |
48 | PG_URL_TEMPLATE = 'http://pg.us.rtl.nl/rtlxl/network/%s/progressive/%s.mp4' |
49 | ||
50 | formats.extend([ | |
51 | { | |
52 | 'url': PG_URL_TEMPLATE % ('a2m', video_urlpart), | |
53 | 'format_id': 'pg-sd', | |
54 | }, | |
55 | { | |
56 | 'url': PG_URL_TEMPLATE % ('a3m', video_urlpart), | |
57 | 'format_id': 'pg-hd', | |
480b7c32 | 58 | 'quality': 0, |
de2d9f5f S |
59 | } |
60 | ]) | |
61 | ||
37eddd31 NJ |
62 | self._sort_formats(formats) |
63 | ||
6493f5d7 JMF |
64 | return { |
65 | 'id': uuid, | |
7adcbe75 | 66 | 'title': '%s - %s' % (progname, subtitle), |
de2d9f5f | 67 | 'formats': formats, |
6493f5d7 JMF |
68 | 'timestamp': material['original_date'], |
69 | 'description': episode_info['synopsis'], | |
7adcbe75 | 70 | 'duration': parse_duration(material.get('duration')), |
6493f5d7 | 71 | } |