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': '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,