]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rtvs.py
Prepare to upload.
[youtubedl] / youtube_dl / extractor / rtvs.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class RTVSIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv/\d+/(?P<id>\d+)'
9 _TESTS = [{
10 # radio archive
11 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
12 'md5': '134d5d6debdeddf8a5d761cbc9edacb8',
13 'info_dict': {
14 'id': '414872',
15 'ext': 'mp3',
16 'title': 'Ostrov pokladov 1 časť.mp3'
17 },
18 'params': {
19 'skip_download': True,
20 }
21 }, {
22 # tv archive
23 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
24 'md5': '85e2c55cf988403b70cac24f5c086dc6',
25 'info_dict': {
26 'id': '63118',
27 'ext': 'mp4',
28 'title': 'Amaro Džives - Náš deň',
29 'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.'
30 },
31 'params': {
32 'skip_download': True,
33 }
34 }]
35
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
38
39 webpage = self._download_webpage(url, video_id)
40
41 playlist_url = self._search_regex(
42 r'playlist["\']?\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
43 'playlist url', group='url')
44
45 data = self._download_json(
46 playlist_url, video_id, 'Downloading playlist')[0]
47 return self._parse_jwplayer_data(data, video_id=video_id)