2014-12-06 18:01:52 +01:00
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
class RadioDeIE(InfoExtractor):
|
2024-03-09 01:02:45 +01:00
|
|
|
_WORKING = False
|
2014-12-06 18:01:52 +01:00
|
|
|
IE_NAME = 'radio.de'
|
|
|
|
_VALID_URL = r'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
|
|
|
|
_TEST = {
|
|
|
|
'url': 'http://ndr2.radio.de/',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'ndr2',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'title': 're:^NDR 2 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
|
|
|
'description': 'md5:591c49c702db1a33751625ebfb67f273',
|
2017-01-02 13:08:07 +01:00
|
|
|
'thumbnail': r're:^https?://.*\.png',
|
2015-02-17 19:54:04 +01:00
|
|
|
'is_live': True,
|
2014-12-06 18:01:52 +01:00
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
2024-06-12 01:09:58 +02:00
|
|
|
},
|
2014-12-06 18:01:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
radio_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, radio_id)
|
2015-02-17 19:54:04 +01:00
|
|
|
jscode = self._search_regex(
|
|
|
|
r"'components/station/stationService':\s*\{\s*'?station'?:\s*(\{.*?\s*\}),\n",
|
|
|
|
webpage, 'broadcast')
|
2014-12-06 18:01:52 +01:00
|
|
|
|
2015-02-17 19:54:04 +01:00
|
|
|
broadcast = self._parse_json(jscode, radio_id)
|
2021-12-15 17:00:46 +01:00
|
|
|
title = broadcast['name']
|
2014-12-06 18:01:52 +01:00
|
|
|
description = broadcast.get('description') or broadcast.get('shortDescription')
|
2015-02-17 19:54:04 +01:00
|
|
|
thumbnail = broadcast.get('picture4Url') or broadcast.get('picture4TransUrl') or broadcast.get('logo100x100')
|
2014-12-06 18:01:52 +01:00
|
|
|
|
|
|
|
formats = [{
|
|
|
|
'url': stream['streamUrl'],
|
|
|
|
'ext': stream['streamContentFormat'].lower(),
|
|
|
|
'acodec': stream['streamContentFormat'],
|
|
|
|
'abr': stream['bitRate'],
|
2024-06-12 01:09:58 +02:00
|
|
|
'asr': stream['sampleRate'],
|
2014-12-06 18:01:52 +01:00
|
|
|
} for stream in broadcast['streamUrls']]
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': radio_id,
|
|
|
|
'title': title,
|
|
|
|
'description': description,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'is_live': True,
|
|
|
|
'formats': formats,
|
|
|
|
}
|