Merge remote-tracking branch 'olebowle/gameone'
[youtube-dl] / youtube_dl / extractor / rtlnl.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class RtlXlIE(InfoExtractor):
9     IE_NAME = 'rtlxl.nl'
10     _VALID_URL = r'https?://www\.rtlxl\.nl/#!/[^/]+/(?P<uuid>[^/?]+)'
11
12     _TEST = {
13         'url': 'http://www.rtlxl.nl/#!/rtl-nieuws-132237/6e4203a6-0a5e-3596-8424-c599a59e0677',
14         'info_dict': {
15             'id': '6e4203a6-0a5e-3596-8424-c599a59e0677',
16             'ext': 'flv',
17             'title': 'RTL Nieuws - Laat',
18             'description': 'Dagelijks het laatste nieuws uit binnen- en '
19                 'buitenland. Voor nog meer nieuws kunt u ook gebruikmaken van '
20                 'onze mobiele apps.',
21             'timestamp': 1408051800,
22             'upload_date': '20140814',
23         },
24         'params': {
25             # We download the first bytes of the first fragment, it can't be
26             # processed by the f4m downloader beacuse it isn't complete
27             'skip_download': True,
28         },
29     }
30
31     def _real_extract(self, url):
32         mobj = re.match(self._VALID_URL, url)
33         uuid = mobj.group('uuid')
34
35         info = self._download_json(
36             'http://www.rtl.nl/system/s4m/vfd/version=2/uuid=%s/fmt=flash/' % uuid,
37             uuid)
38         material = info['material'][0]
39         episode_info = info['episodes'][0]
40
41         f4m_url = 'http://manifest.us.rtl.nl' + material['videopath']
42         progname = info['abstracts'][0]['name']
43         subtitle = material['title'] or info['episodes'][0]['name']
44
45         return {
46             'id': uuid,
47             'title': '%s - %s' % (progname, subtitle), 
48             'formats': self._extract_f4m_formats(f4m_url, uuid),
49             'timestamp': material['original_date'],
50             'description': episode_info['synopsis'],
51         }