]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/radiode.py
f95bc9454334b9ca15c5f74cf034cebd26487841
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class RadioDeIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
12 'url': 'http://ndr2.radio.de/',
13 'md5': '3b4cdd011bc59174596b6145cda474a4',
17 'title': 're:^NDR 2 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
18 'description': 'md5:591c49c702db1a33751625ebfb67f273',
19 'thumbnail': 're:^https?://.*\.png',
22 'skip_download': True,
26 def _real_extract(self
, url
):
27 radio_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, radio_id
)
31 broadcast
= json
.loads(self
._search
_regex
(
32 r
'_getBroadcast\s*=\s*function\(\s*\)\s*{\s*return\s+({.+?})\s*;\s*}',
33 webpage
, 'broadcast'))
35 title
= self
._live
_title
(broadcast
['name'])
36 description
= broadcast
.get('description') or broadcast
.get('shortDescription')
37 thumbnail
= broadcast
.get('picture4Url') or broadcast
.get('picture4TransUrl')
40 'url': stream
['streamUrl'],
41 'ext': stream
['streamContentFormat'].lower(),
42 'acodec': stream
['streamContentFormat'],
43 'abr': stream
['bitRate'],
44 'asr': stream
['sampleRate']
45 } for stream
in broadcast
['streamUrls']]
46 self
._sort
_formats
(formats
)
51 'description': description
,
52 'thumbnail': thumbnail
,