diff --git a/youtube_dl/extractor/wdr.py b/youtube_dl/extractor/wdr.py index 23e26f8d3..ce9918ce0 100644 --- a/youtube_dl/extractor/wdr.py +++ b/youtube_dl/extractor/wdr.py @@ -21,7 +21,7 @@ class WDRIE(InfoExtractor): _TESTS = [ { - 'url': 'http://www1.wdr.de/mediathek/video/sendungen/hier_und_heute/videostreetfoodpioniere100.html', + 'url': 'http://www1.wdr.de/mediathek/video/sendungen/hier_und_heute/videostreetfoodpioniere100.html', # Test single media extraction (video) 'info_dict': { 'id': 'mdb-750693', 'ext': 'mp4', @@ -36,38 +36,46 @@ class WDRIE(InfoExtractor): }, }, { - 'url': 'http://www1.wdr.de/mediathek/audio/1live/einslive-bahnansage-100.html', + 'url': 'http://www1.wdr.de/mediathek/audio/1live/einslive-bahnansage-100.html', # Test single media extraction (audio) 'md5': '87c389aac18ee6fc041aa1ced52aac76', 'info_dict': { 'id': 'mdb-726385', 'ext': 'mp3', 'title': '1LIVE Bahnansage', - 'description': 'md5:36016b06288e1f1a5b2602c8fe947b8d', + 'description': 'md5:8b9ef2af8c1bb01394ab98f3450ff04d', 'upload_date': '20150604', 'is_live': False }, }, { - 'url': 'http://www.funkhauseuropa.de/musik/musikspecials/roskilde-zweitausendfuenfzehn-100.html', + 'url': 'http://www.funkhauseuropa.de/musik/musikspecials/roskilde-zweitausendfuenfzehn-100.html', # Test single media extraction (audio) 'md5': 'e50e0c8900f6558ae12cd9953aca5a20', 'info_dict': { 'id': 'mdb-752045', 'ext': 'mp3', 'title': 'Roskilde Festival 2015', - 'description': 'md5:7b29e97e10dfb6e265238b32fa35b23a', + 'description': 'md5:48e7a0a884c0e841a9d9174e27c67df3', 'upload_date': '20150702', 'is_live': False }, }, { - 'url': 'http://www1.wdr.de/mediathek/video/sendungen/quarks_und_co/filterseite-quarks-und-co100.html', + 'url': 'http://www1.wdr.de/mediathek/video/sendungen/quarks_und_co/filterseite-quarks-und-co100.html', # Test playlist extraction (containing links to webpages) 'playlist_mincount': 146, 'info_dict': { 'id': 'mediathek/video/sendungen/quarks_und_co/filterseite-quarks-und-co100', + 'title': 'md5:31d3634678b18f90a9fc4e7cd34ba3b2' } }, { - 'url': 'http://www1.wdr.de/mediathek/video/livestream/index.html', + 'url': 'http://www.funkhauseuropa.de/index.html', # Test playlist extraction (containing links to playerpages) + 'playlist_mincount': 3, + 'info_dict': { + 'id': 'index', + } + }, + { + 'url': 'http://www1.wdr.de/mediathek/video/livestream/index.html', # Test live tv 'info_dict': { 'id': 'mdb-103364', 'title': 're:^24 Stunden Livestream [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', @@ -82,23 +90,7 @@ class WDRIE(InfoExtractor): } ] - def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - page_url = mobj.group('url') - page_id = mobj.group('id') - - webpage = self._download_webpage(url, page_id) - - if mobj.group('player') is None: - entries = [ - self.url_result(page_url + href, 'WDR') - for href in re.findall(r'\n\n 1: # Different playlist page + return self.playlist_result(entries, page_id) + + elif mobj.group('player') is not None or (entries and len(entries) == 1): # Media page (either just a single player link on the webpage or the webpage is the player) + if not entries: + entries = None + return self._media_extract(page_url, page_id, mobj, webpage, entries) + class WDRMobileIE(InfoExtractor): _VALID_URL = r'''(?x)