3 from .common
import InfoExtractor
11 class RTVSIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv(?:/\d+)?/(?P<id>\d+)/?(?:[#?]|$)'
15 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
16 'md5': '134d5d6debdeddf8a5d761cbc9edacb8',
20 'title': 'Ostrov pokladov 1 časť.mp3',
22 'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0000/b1R8.rtvs.jpg',
23 'display_id': '135331',
27 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
31 'title': 'Amaro Džives - Náš deň',
32 'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.',
33 'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0031/L7Qm.amaro_dzives_png.jpg',
34 'timestamp': 1428555900,
35 'upload_date': '20150409',
40 'url': 'https://www.rtvs.sk/televizia/archiv/18083?utm_source=web&utm_medium=rozcestnik&utm_campaign=Robin',
45 'description': 'md5:2f70505a7b8364491003d65ff7a0940a',
46 'timestamp': 1636652760,
47 'display_id': '307655',
49 'upload_date': '20211111',
50 'thumbnail': 'https://www.rtvs.sk/media/a501/image/file/2/0916/robin.jpg',
54 def _real_extract(self
, url
):
55 video_id
= self
._match
_id
(url
)
57 webpage
= self
._download
_webpage
(url
, video_id
)
58 iframe_id
= self
._search
_regex
(
59 r
'<iframe[^>]+id\s*=\s*"player_[^_]+_([0-9]+)"', webpage
, 'Iframe ID')
60 iframe_url
= self
._search
_regex
(
61 fr
'<iframe[^>]+id\s*=\s*"player_[^_]+_{re.escape(iframe_id)}"[^>]+src\s*=\s*"([^"]+)"', webpage
, 'Iframe URL')
63 webpage
= self
._download
_webpage
(iframe_url
, video_id
, 'Downloading iframe')
64 json_url
= self
._search
_regex
(r
'var\s+url\s*=\s*"([^"]+)"\s*\+\s*ruurl', webpage
, 'json URL')
65 data
= self
._download
_json
(f
'https:{json_url}b=mozilla&p=win&v=97&f=0&d=1', video_id
)
68 data
['playlist'] = [data
['clip']]
70 if traverse_obj(data
, ('playlist', 0, 'sources', 0, 'type')) == 'audio/mp3':
71 formats
= [{'url': traverse_obj(data
, ('playlist', 0, 'sources', 0, 'src'))}]
73 formats
= self
._extract
_m
3u8_formats
(traverse_obj(data
, ('playlist', 0, 'sources', 0, 'src')), video_id
)
77 'display_id': iframe_id
,
78 'title': traverse_obj(data
, ('playlist', 0, 'title')),
79 'description': traverse_obj(data
, ('playlist', 0, 'description')),
80 'duration': parse_duration(traverse_obj(data
, ('playlist', 0, 'length'))),
81 'thumbnail': traverse_obj(data
, ('playlist', 0, 'image')),
82 'timestamp': unified_timestamp(traverse_obj(data
, ('playlist', 0, 'datetime_create'))),