1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-09 16:22:50 +08:00

[wdr] add support for wdrmaus.de content pages as playlists

The content pages directly contain multiple video players without
linking to a separate page for each video, like the Mediathek pages do.
Therefore, we cannot delegate loading the info_dict from a "video URL"
(because it does not exist), but instead we have to grab each video
separately from their video player <divs> and load the info_dict from
the respective JSONP.

On the other hand, Mediathek pages only contain links to the separate
video pages, and no JSONP URL, so we still need to support the old way
of loading each video page separately when playing the playlist.
This commit is contained in:
Roland Hieber 2017-05-21 16:31:27 +02:00
parent 9436165909
commit 2437a7ae4e

View File

@ -105,9 +105,9 @@ class WDRBaseIE(InfoExtractor):
class WDRIE(WDRBaseIE):
_CURRENT_MAUS_URL = r'https?://(?:www\.)wdrmaus.de/(?:[^/]+/){1,2}[^/?#]+\.php5'
_WDR_MAUS_REGEX = r'https?://(?:www\.)wdrmaus.de/(?P<display_id_maus>(?:[^/]+/){1,4}[^/?#]+)\.php5'
_PAGE_REGEX = r'/(?:mediathek/)?[^/]+/(?P<type>[^/]+)/(?P<display_id>.+)\.html'
_VALID_URL = r'(?P<page_url>https?://(?:www\d\.)?wdr\d?\.de)' + _PAGE_REGEX + '|' + _CURRENT_MAUS_URL
_VALID_URL = r'(?P<page_url>https?://(?:www\d\.)?wdr\d?\.de)' + _PAGE_REGEX + '|' + _WDR_MAUS_REGEX
_TESTS = [
{
@ -187,6 +187,13 @@ class WDRIE(WDRBaseIE):
'description': 'Die Seite mit der Maus -',
},
},
{
'url': 'http://www.wdrmaus.de/extras/mausthemen/eisenbahn/index.php5',
'playlist_mincount': 8,
'info_dict': {
'id': 'extras/mausthemen/eisenbahn/index',
},
},
{
'url': 'http://www1.wdr.de/radio/player/radioplayer116~_layout-popupVersion.html',
# Live stream, MD5 unstable
@ -210,6 +217,7 @@ class WDRIE(WDRBaseIE):
jsonp_urls = self._extract_wdr_jsonp_urls(webpage, display_id)
if not jsonp_urls:
# WDR Mediathek playlist pages contain links to the single video pages:
entries = [
self.url_result(page_url + href[0], 'WDR')
for href in re.findall(
@ -222,6 +230,19 @@ class WDRIE(WDRBaseIE):
raise ExtractorError('No downloadable streams found', expected=True)
elif len(jsonp_urls) > 1:
# wdrmaus playlist pages directly contain the JSONP URLs:
display_id = mobj.group('display_id_maus')
entries = [
self._extract_wdr_video_from_jsonp_url(jsonp_url, display_id)
for jsonp_url in jsonp_urls
]
return { '_type': 'playlist', 'entries': entries, 'id': display_id }
else:
# page with a single video
info_dict = self._extract_wdr_video_from_jsonp_url(jsonp_urls[0], display_id)
is_live = url_type == 'live'
if is_live: