From b461641fb9e11ca4e5fcb2262d281e1efe12a560 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sergey=20M=E2=80=A4?= Date: Wed, 12 Mar 2014 04:20:47 +0700 Subject: [PATCH] [wdr] Add support for WDR sites (Closes #1367) --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/wdr.py | 111 +++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 youtube_dl/extractor/wdr.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 49617a5e0..f06b4d1dc 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -268,6 +268,7 @@ from .viki import VikiIE from .vk import VKIE from .vube import VubeIE from .wat import WatIE +from .wdr import WDRIE from .weibo import WeiboIE from .wimp import WimpIE from .wistia import WistiaIE diff --git a/youtube_dl/extractor/wdr.py b/youtube_dl/extractor/wdr.py new file mode 100644 index 000000000..1238c15aa --- /dev/null +++ b/youtube_dl/extractor/wdr.py @@ -0,0 +1,111 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + unified_strdate, + compat_urlparse, + determine_ext, +) + + +class WDRIE(InfoExtractor): + _PLAYER_REGEX = '-(?:video|audio)player(?:_size-[LMS])?' + _VALID_URL = r'(?Phttps?://www\d?\.(?:wdr\d?|funkhauseuropa)\.de/)(?P.+?)(?P%s)?\.html' % _PLAYER_REGEX + + _TESTS = [ + { + 'url': 'http://www1.wdr.de/mediathek/video/sendungen/servicezeit/videoservicezeit560-videoplayer_size-L.html', + 'info_dict': { + 'id': 'mdb-362427', + 'ext': 'flv', + 'title': 'Servicezeit', + 'description': 'md5:c8f43e5e815eeb54d0b96df2fba906cb', + 'upload_date': '20140310', + }, + 'params': { + 'skip_download': True, + }, + }, + { + 'url': 'http://www1.wdr.de/themen/av/videomargaspiegelisttot101-videoplayer.html', + 'info_dict': { + 'id': 'mdb-363194', + 'ext': 'flv', + 'title': 'Marga Spiegel ist tot', + 'upload_date': '20140311', + }, + 'params': { + 'skip_download': True, + }, + }, + { + 'url': 'http://www1.wdr.de/themen/kultur/audioerlebtegeschichtenmargaspiegel100-audioplayer.html', + 'md5': '83e9e8fefad36f357278759870805898', + 'info_dict': { + 'id': 'mdb-194332', + 'ext': 'mp3', + 'title': 'Erlebte Geschichten: Marga Spiegel (29.11.2009)', + 'upload_date': '20091129', + }, + }, + { + 'url': 'http://www.funkhauseuropa.de/av/audiogrenzenlosleckerbaklava101-audioplayer.html', + 'md5': 'cfff440d4ee64114083ac44676df5d15', + 'info_dict': { + 'id': 'mdb-363068', + 'ext': 'mp3', + 'title': 'Grenzenlos lecker - Baklava', + 'upload_date': '20140311', + }, + }, + ] + + 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'