mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 20:22:14 +00:00
[wdr] Simplify extraction
This commit is contained in:
parent
50918c4ee0
commit
6869d634c6
1 changed files with 34 additions and 30 deletions
|
@ -10,6 +10,7 @@ from ..utils import (
|
||||||
strip_jsonp,
|
strip_jsonp,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
update_url_query,
|
||||||
urlhandle_detect_ext,
|
urlhandle_detect_ext,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -100,9 +101,10 @@ class WDRIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://www1.wdr.de/radio/player/radioplayer116~_layout-popupVersion.html',
|
'url': 'http://www1.wdr.de/radio/player/radioplayer116~_layout-popupVersion.html',
|
||||||
|
# Live stream, MD5 unstable
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'mdb-869971',
|
'id': 'mdb-869971',
|
||||||
'ext': 'mp3',
|
'ext': 'flv',
|
||||||
'title': 'Funkhaus Europa Livestream',
|
'title': 'Funkhaus Europa Livestream',
|
||||||
'description': 'md5:2309992a6716c347891c045be50992e4',
|
'description': 'md5:2309992a6716c347891c045be50992e4',
|
||||||
'upload_date': '20160101',
|
'upload_date': '20160101',
|
||||||
|
@ -150,37 +152,39 @@ class WDRIE(InfoExtractor):
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
# check if the metadata contains a direct URL to a file
|
# check if the metadata contains a direct URL to a file
|
||||||
metadata_media_alt = metadata_media_resource.get('alt')
|
for kind, media_resource in metadata_media_resource.items():
|
||||||
if metadata_media_alt:
|
if kind not in ('dflt', 'alt'):
|
||||||
for tag_name in ['videoURL', 'audioURL']:
|
continue
|
||||||
if tag_name in metadata_media_alt:
|
|
||||||
alt_url = metadata_media_alt[tag_name]
|
for tag_name, medium_url in media_resource.items():
|
||||||
ext = determine_ext(alt_url)
|
if tag_name not in ('videoURL', 'audioURL'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
ext = determine_ext(medium_url)
|
||||||
if ext == 'm3u8':
|
if ext == 'm3u8':
|
||||||
m3u_fmt = self._extract_m3u8_formats(
|
m3u_fmt = self._extract_m3u8_formats(
|
||||||
alt_url, display_id, 'mp4', 'm3u8_native',
|
medium_url, display_id, 'mp4', 'm3u8_native',
|
||||||
m3u8_id='hls')
|
m3u8_id='hls')
|
||||||
formats.extend(m3u_fmt)
|
formats.extend(m3u_fmt)
|
||||||
|
elif ext == 'f4m':
|
||||||
|
manifest_url = update_url_query(
|
||||||
|
medium_url, {'hdcore': '3.2.0', 'plugin': 'aasp-3.2.0.77.18'})
|
||||||
|
formats.extend(self._extract_f4m_formats(
|
||||||
|
manifest_url, display_id, f4m_id='hds', fatal=False))
|
||||||
|
elif ext == 'smil':
|
||||||
|
formats.extend(self._extract_smil_formats(
|
||||||
|
medium_url, 'stream', fatal=False))
|
||||||
else:
|
else:
|
||||||
a_format = {
|
a_format = {
|
||||||
'url': alt_url
|
'url': medium_url
|
||||||
}
|
}
|
||||||
if ext == 'unknown_video':
|
if ext == 'unknown_video':
|
||||||
urlh = self._request_webpage(
|
urlh = self._request_webpage(
|
||||||
alt_url, display_id, note='Determining extension')
|
medium_url, display_id, note='Determining extension')
|
||||||
ext = urlhandle_detect_ext(urlh)
|
ext = urlhandle_detect_ext(urlh)
|
||||||
a_format['ext'] = ext
|
a_format['ext'] = ext
|
||||||
formats.append(a_format)
|
formats.append(a_format)
|
||||||
|
|
||||||
# check if there are flash-streams for this video
|
|
||||||
if 'dflt' in metadata_media_resource and 'videoURL' in metadata_media_resource['dflt']:
|
|
||||||
video_url = metadata_media_resource['dflt']['videoURL']
|
|
||||||
if video_url.endswith('.f4m'):
|
|
||||||
full_video_url = video_url + '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18'
|
|
||||||
formats.extend(self._extract_f4m_formats(full_video_url, display_id, f4m_id='hds', fatal=False))
|
|
||||||
elif video_url.endswith('.smil'):
|
|
||||||
formats.extend(self._extract_smil_formats(video_url, 'stream', fatal=False))
|
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
caption_url = metadata_media_resource.get('captionURL')
|
caption_url = metadata_media_resource.get('captionURL')
|
||||||
if caption_url:
|
if caption_url:
|
||||||
|
|
Loading…
Reference in a new issue