diff options
author | remitamine <remitamine@gmail.com> | 2016-03-11 22:44:18 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2016-03-11 22:44:18 +0100 |
commit | c8868a9d83291c4502126ca375300026cc90acf9 (patch) | |
tree | 36942bbd05c5c147abab72b0698251bbffddc1d1 /youtube_dl/extractor | |
parent | 09f572fbc07e79cc3f62e65149237ee1952aa12b (diff) |
[dw] Add new extractor
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/dw.py | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1a7d689df..4bc7fbab0 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -189,6 +189,7 @@ from .dumpert import DumpertIE from .defense import DefenseGouvFrIE from .discovery import DiscoveryIE from .dropbox import DropboxIE +from .dw import DWIE from .eagleplatform import EaglePlatformIE from .ebaumsworld import EbaumsWorldIE from .echomsk import EchoMskIE diff --git a/youtube_dl/extractor/dw.py b/youtube_dl/extractor/dw.py new file mode 100644 index 000000000..df901e1b2 --- /dev/null +++ b/youtube_dl/extractor/dw.py @@ -0,0 +1,43 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import int_or_none + + +class DWIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?dw\.com/(?:[^/]+/)+av-(?P<id>\d+)' + _TEST = { + 'url': 'http://www.dw.com/en/intelligent-light/av-19112290', + 'md5': '7372046e1815c5a534b43f3c3c36e6e9', + 'info_dict': { + 'id': '19112290', + 'ext': 'mp4', + 'title': 'Intelligent light', + 'description': 'md5:90e00d5881719f2a6a5827cb74985af1', + 'upload_date': '20160311', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + + formats = self._extract_smil_formats( + 'http://www.dw.com/smil/v-%s' % video_id, video_id, + transform_source=lambda s: s.replace( + 'rtmp://tv-od.dw.de/flash/', + 'http://tv-download.dw.de/dwtv_video/flv/')) + + webpage = self._download_webpage(url, video_id) + hidden_inputs = self._hidden_inputs(webpage) + title = hidden_inputs['media_title'] + + return { + 'id': video_id, + 'title': title, + 'description': self._og_search_description(webpage), + 'thumbnail': hidden_inputs.get('preview_image'), + 'duration': int_or_none(hidden_inputs.get('file_duration')), + 'upload_date': hidden_inputs.get('display_date'), + 'formats': formats, + } |