]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rtl2.py
721ee733ce38c7e4a95c7806b10bbbd346166451
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class RTL2IE(InfoExtractor
):
11 _VALID_URL
= r
'http?://(?:www\.)?rtl2\.de/[^?#]*?/(?P<id>[^?#/]*?)(?:$|/(?:$|[?#]))'
13 'url': 'http://www.rtl2.de/sendung/grip-das-motormagazin/folge/folge-203-0',
17 'title': 'GRIP sucht den Sommerkönig',
18 'description': 'md5:e3adbb940fd3c6e76fa341b8748b562f'
22 'skip_download': True,
25 'url': 'http://www.rtl2.de/sendung/koeln-50667/video/5512-anna/21040-anna-erwischt-alex/',
27 'id': '21040-anna-erwischt-alex',
29 'title': 'Anna erwischt Alex!',
30 'description': 'Anna nimmt ihrem Vater nicht ab, dass er nicht spielt. Und tatsächlich erwischt sie ihn auf frischer Tat.'
34 'skip_download': True,
38 def _real_extract(self
, url
):
39 # Some rtl2 urls have no slash at the end, so append it.
40 if not url
.endswith('/'):
43 video_id
= self
._match
_id
(url
)
44 webpage
= self
._download
_webpage
(url
, video_id
)
47 r
'<div[^>]+data-collection="(?P<vico_id>\d+)"[^>]+data-video="(?P<vivi_id>\d+)"',
50 vico_id
= mobj
.group('vico_id')
51 vivi_id
= mobj
.group('vivi_id')
53 vico_id
= self
._html
_search
_regex
(
54 r
'vico_id\s*:\s*([0-9]+)', webpage
, 'vico_id')
55 vivi_id
= self
._html
_search
_regex
(
56 r
'vivi_id\s*:\s*([0-9]+)', webpage
, 'vivi_id')
58 info
= self
._download
_json
(
59 'http://www.rtl2.de/sites/default/modules/rtl2/mediathek/php/get_video_jw.php',
64 video_info
= info
['video']
65 title
= video_info
['titel']
69 rtmp_url
= video_info
.get('streamurl')
71 rtmp_url
= rtmp_url
.replace('\\', '')
72 stream_url
= 'mp4:' + self
._html
_search
_regex
(r
'/ondemand/(.+)', rtmp_url
, 'stream URL')
73 rtmp_conn
= ['S:connect', 'O:1', 'NS:pageUrl:' + url
, 'NB:fpad:0', 'NN:videoFunction:1', 'O:0']
78 'play_path': stream_url
,
79 'player_url': 'http://www.rtl2.de/flashplayer/vipo_player.swf',
81 'flash_version': 'LNX 11,2,202,429',
82 'rtmp_conn': rtmp_conn
,
87 m3u8_url
= video_info
.get('streamurl_hls')
89 formats
.extend(self
._extract
_akamai
_formats
(m3u8_url
, video_id
))
91 self
._sort
_formats
(formats
)
96 'thumbnail': video_info
.get('image'),
97 'description': video_info
.get('beschreibung'),
98 'duration': int_or_none(video_info
.get('duration')),