mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09:00
[radio.de] Fix extraction
This commit is contained in:
parent
4a8d4a53b1
commit
98f000409f
@ -1,7 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
@ -10,13 +8,13 @@ class RadioDeIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
|
_VALID_URL = r'https?://(?P<id>.+?)\.(?:radio\.(?:de|at|fr|pt|es|pl|it)|rad\.io)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://ndr2.radio.de/',
|
'url': 'http://ndr2.radio.de/',
|
||||||
'md5': '3b4cdd011bc59174596b6145cda474a4',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ndr2',
|
'id': 'ndr2',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': 're:^NDR 2 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
'title': 're:^NDR 2 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
||||||
'description': 'md5:591c49c702db1a33751625ebfb67f273',
|
'description': 'md5:591c49c702db1a33751625ebfb67f273',
|
||||||
'thumbnail': 're:^https?://.*\.png',
|
'thumbnail': 're:^https?://.*\.png',
|
||||||
|
'is_live': True,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -25,16 +23,15 @@ class RadioDeIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
radio_id = self._match_id(url)
|
radio_id = self._match_id(url)
|
||||||
|
|
||||||
webpage = self._download_webpage(url, radio_id)
|
webpage = self._download_webpage(url, radio_id)
|
||||||
|
jscode = self._search_regex(
|
||||||
|
r"'components/station/stationService':\s*\{\s*'?station'?:\s*(\{.*?\s*\}),\n",
|
||||||
|
webpage, 'broadcast')
|
||||||
|
|
||||||
broadcast = json.loads(self._search_regex(
|
broadcast = self._parse_json(jscode, radio_id)
|
||||||
r'_getBroadcast\s*=\s*function\(\s*\)\s*{\s*return\s+({.+?})\s*;\s*}',
|
|
||||||
webpage, 'broadcast'))
|
|
||||||
|
|
||||||
title = self._live_title(broadcast['name'])
|
title = self._live_title(broadcast['name'])
|
||||||
description = broadcast.get('description') or broadcast.get('shortDescription')
|
description = broadcast.get('description') or broadcast.get('shortDescription')
|
||||||
thumbnail = broadcast.get('picture4Url') or broadcast.get('picture4TransUrl')
|
thumbnail = broadcast.get('picture4Url') or broadcast.get('picture4TransUrl') or broadcast.get('logo100x100')
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': stream['streamUrl'],
|
'url': stream['streamUrl'],
|
||||||
|
Loading…
Reference in New Issue
Block a user