]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/radiode.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
6 class RadioDeIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
10 'url': 'http://ndr2.radio.de/',
14 'title': 're:^NDR 2 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
15 'description': 'md5:591c49c702db1a33751625ebfb67f273',
16 'thumbnail': r
're:^https?://.*\.png',
20 'skip_download': True,
24 def _real_extract(self
, url
):
25 radio_id
= self
._match
_id
(url
)
26 webpage
= self
._download
_webpage
(url
, radio_id
)
27 jscode
= self
._search
_regex
(
28 r
"'components/station/stationService':\s*\{\s*'?station'?:\s*(\{.*?\s*\}),\n",
31 broadcast
= self
._parse
_json
(jscode
, radio_id
)
32 title
= self
._live
_title
(broadcast
['name'])
33 description
= broadcast
.get('description') or broadcast
.get('shortDescription')
34 thumbnail
= broadcast
.get('picture4Url') or broadcast
.get('picture4TransUrl') or broadcast
.get('logo100x100')
37 'url': stream
['streamUrl'],
38 'ext': stream
['streamContentFormat'].lower(),
39 'acodec': stream
['streamContentFormat'],
40 'abr': stream
['bitRate'],
41 'asr': stream
['sampleRate']
42 } for stream
in broadcast
['streamUrls']]
43 self
._sort
_formats
(formats
)
48 'description': description
,
49 'thumbnail': thumbnail
,