]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/rozhlas.py
1 from . common
import InfoExtractor
2 from .. utils
import extract_attributes
, int_or_none
, remove_start
, traverse_obj
5 class RozhlasIE ( InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?prehravac\.rozhlas\.cz/audio/(?P<id>[0-9]+)'
8 'url' : 'http://prehravac.rozhlas.cz/audio/3421320' ,
9 'md5' : '504c902dbc9e9a1fd50326eccf02a7e2' ,
13 'title' : 'Echo Pavla Klusáka (30.06.2015 21:00)' ,
14 'description' : 'Osmdesátiny Terryho Rileyho jsou skvělou příležitostí proletět se elektronickými i akustickými díly zakladatatele minimalismu, který je aktivní už přes padesát let'
17 'url' : 'http://prehravac.rozhlas.cz/audio/3421320/embed' ,
18 'only_matching' : True ,
21 def _real_extract ( self
, url
):
22 audio_id
= self
._ match
_ id
( url
)
24 webpage
= self
._ download
_ webpage
(
25 'http://prehravac.rozhlas.cz/audio/ %s ' % audio_id
, audio_id
)
27 title
= self
._ html
_ search
_ regex
(
28 r
'<h3>(.+?)</h3>\s*<p[^>]*>.*?</p>\s*<div[^>]+id=["\' ] player
- track
',
29 webpage, ' title
', default=None) or remove_start(
30 self._og_search_title(webpage), ' Radio Wave
- ')
31 description = self._html_search_regex(
32 r' < p
[ ^
>]+ title
=([ " \' ])(?P<url>(?:(?!\1).)+)\1[^>]*>.*?</p>\s*<div[^>]+id=[" \' ] player
- track
',
33 webpage, ' description
', fatal=False, group=' url
')
34 duration = int_or_none(self._search_regex(
35 r' data
- duration
=[ " \' ](\d+)', webpage, 'duration', default=None))
39 'url': 'http://media.rozhlas.cz/_audio/ %s .mp3' % audio_id,
41 'description': description,
47 class RozhlasVltavaIE(InfoExtractor):
48 _VALID_URL = r'https?://(?:\w+\.rozhlas|english\.radio)\.cz/[\w-]+-(?P<id>\d+)'
50 'url': 'https://wave.rozhlas.cz/papej-masicko-porcujeme-a-bilancujeme-filmy-a-serialy-ktere-letos-zabily-8891337',
51 'md5': 'ba2fdbc1242fc16771c7695d271ec355',
54 'title': 'md5:21f99739d04ab49d8c189ec711eef4ec',
58 'md5': 'ba2fdbc1242fc16771c7695d271ec355',
62 'title': 'Papej masíčko! Porcujeme a bilancujeme filmy a seriály, které to letos zabily',
63 'description': 'md5:1c6d29fb9564e1f17fc1bb83ae7da0bc',
65 'artist': 'Aleš Stuchlý',
66 'channel_id': 'radio-wave',
70 'url': 'https://wave.rozhlas.cz/poslechnete-si-neklid-podcastovy-thriller-o-vine-strachu-a-vztahu-ktery-zasel-8554744',
73 'title': 'Poslechněte si Neklid. Podcastový thriller o vině, strachu a vztahu, který zašel příliš daleko',
77 'md5': '93d4109cf8f40523699ae9c1d4600bdd',
82 'description': '1. díl: Neklid: 1. díl',
84 'artist': 'Josef Kokta',
85 'channel_id': 'radio-wave',
86 'chapter': 'Neklid #1',
90 'md5': 'e9763235be4a6dcf94bc8a5bac1ca126',
95 'description': '2. díl: Neklid: 2. díl',
97 'artist': 'Josef Kokta',
98 'channel_id': 'radio-wave',
99 'chapter': 'Neklid #2',
103 'md5': '00b642ea94b78cc949ac84da09f87895',
107 'title': 'Neklid #3',
108 'description': '3. díl: Neklid: 3. díl',
110 'artist': 'Josef Kokta',
111 'channel_id': 'radio-wave',
112 'chapter': 'Neklid #3',
116 'md5': 'faef97b1b49da7df874740f118c19dea',
120 'title': 'Neklid #4',
121 'description': '4. díl: Neklid: 4. díl',
123 'artist': 'Josef Kokta',
124 'channel_id': 'radio-wave',
125 'chapter': 'Neklid #4',
129 'md5': '6e729fa39b647325b868d419c76f3efa',
133 'title': 'Neklid #5',
134 'description': '5. díl: Neklid: 5. díl',
136 'artist': 'Josef Kokta',
137 'channel_id': 'radio-wave',
138 'chapter': 'Neklid #5',
144 def _extract_video(self, entry):
145 chapter_number = int_or_none(traverse_obj(entry, ('meta', 'ga', 'contentSerialPart')))
147 'id': entry['meta']['ga']['contentId'],
148 'title': traverse_obj(entry, ('meta', 'ga', 'contentName')),
149 'description': entry.get('title'),
150 'duration': entry.get('duration'),
151 'artist': traverse_obj(entry, ('meta', 'ga', 'contentAuthor')),
152 'channel_id': traverse_obj(entry, ('meta', 'ga', 'contentCreator')),
153 'chapter': traverse_obj(entry, ('meta', 'ga', 'contentNameShort')) if chapter_number else None,
154 'chapter_number': chapter_number,
156 'url': audio_link['url'],
157 'ext': audio_link.get('variant'),
158 'format_id': audio_link.get('variant'),
159 'abr': audio_link.get('bitrate'),
160 'acodec': audio_link.get('variant'),
162 } for audio_link in entry['audioLinks']],
165 def _real_extract(self, url):
166 video_id = self._match_id(url)
167 webpage = self._download_webpage(url, video_id)
169 # FIXME: Use get_element_text_and_html_by_tag when it accepts less strict html
170 data = self._parse_json(extract_attributes(self._search_regex(
171 r'(<div class=" mujRozhlasPlayer
" data-player=\'[^\']+\'>)',
172 webpage, 'player'))['data-player'], video_id)['data']
176 'id': data.get('embedId'),
177 'title': traverse_obj(data, ('series', 'title')),
178 'entries': map(self._extract_video, data['playlist']),