[rtl2] Remove an unused line
[youtube-dl] / youtube_dl / extractor / rtl2.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class RTL2IE(InfoExtractor):
8     _VALID_URL = r'http?://(?:www\.)?rtl2\.de/[^?#]*?/(?P<id>[^?#/]*?)(?:$|/(?:$|[?#]))'
9     _TESTS = [{
10         'url': 'http://www.rtl2.de/sendung/grip-das-motormagazin/folge/folge-203-0',
11         'md5': 'bfcc179030535b08dc2b36b469b5adc7',
12         'info_dict': {
13             'id': 'folge-203-0',
14             'ext': 'f4v',
15             'title': 'GRIP sucht den Sommerkönig',
16             'description': 'Matthias, Det und Helge treten gegeneinander an.'
17         },
18         'params': {
19             # rtmp download
20             'skip_download': True,
21         },
22     }, {
23         'url': 'http://www.rtl2.de/sendung/koeln-50667/video/5512-anna/21040-anna-erwischt-alex/',
24         'md5': 'ffcd517d2805b57ce11a58a2980c2b02',
25         'info_dict': {
26             'id': '21040-anna-erwischt-alex',
27             'ext': 'mp4',
28             'title': 'Anna erwischt Alex!',
29             'description': 'Anna ist Alex\' Tochter bei Köln 50667.'
30         },
31     }]
32
33     def _real_extract(self, url):
34         # Some rtl2 urls have no slash at the end, so append it.
35         if not url.endswith('/'):
36             url += '/'
37
38         video_id = self._match_id(url)
39         webpage = self._download_webpage(url, video_id)
40
41         vico_id = self._html_search_regex(
42             r'vico_id\s*:\s*([0-9]+)', webpage, 'vico_id')
43         vivi_id = self._html_search_regex(
44             r'vivi_id\s*:\s*([0-9]+)', webpage, 'vivi_id')
45         info_url = 'http://www.rtl2.de/video/php/get_video.php?vico_id=' + vico_id + '&vivi_id=' + vivi_id
46
47         info = self._download_json(info_url, video_id)
48         video_info = info['video']
49         title = video_info['titel']
50         description = video_info.get('beschreibung')
51         thumbnail = video_info.get('image')
52
53         download_url = video_info['streamurl']
54         download_url = download_url.replace('\\', '')
55         stream_url = 'mp4:' + self._html_search_regex(r'ondemand/(.*)', download_url, 'stream URL')
56         rtmp_conn = ["S:connect", "O:1", "NS:pageUrl:" + url, "NB:fpad:0", "NN:videoFunction:1", "O:0"]
57
58         formats = [{
59             'url': download_url,
60             'play_path': stream_url,
61             'player_url': 'http://www.rtl2.de/flashplayer/vipo_player.swf',
62             'page_url': url,
63             'flash_version': 'LNX 11,2,202,429',
64             'rtmp_conn': rtmp_conn,
65             'no_resume': True,
66         }]
67         self._sort_formats(formats)
68
69         return {
70             'id': video_id,
71             'title': title,
72             'thumbnail': thumbnail,
73             'description': description,
74             'formats': formats,
75         }