diff options
author | Petr Zvoníček <zvonicek@gmail.com> | 2016-08-07 17:35:54 +0200 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-08-08 04:41:45 +0700 |
commit | e1f93a0a76f054f537c9103a8958e1c1ab631fa5 (patch) | |
tree | 3807f17b61f9cf10c41ba104e1478678c7e13b9a | |
parent | d21a661bb4cbdb92f4db588e3801bb19d4fa96b2 (diff) |
[rozhlas] Add new extractor
-rw-r--r-- | youtube_dl/extractor/extractors.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/rozhlas.py | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index c2c4617ee..7ede6afda 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -696,6 +696,7 @@ from .rockstargames import RockstarGamesIE from .roosterteeth import RoosterTeethIE from .rottentomatoes import RottenTomatoesIE from .roxwel import RoxwelIE +from .rozhlas import RozhlasIE from .rtbf import RTBFIE from .rte import RteIE, RteRadioIE from .rtlnl import RtlNlIE diff --git a/youtube_dl/extractor/rozhlas.py b/youtube_dl/extractor/rozhlas.py new file mode 100644 index 000000000..ef99b5b1f --- /dev/null +++ b/youtube_dl/extractor/rozhlas.py @@ -0,0 +1,34 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class RozhlasIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?prehravac\.rozhlas\.cz/audio/(?P<id>[0-9]+)' + _TEST = { + 'url': 'http://prehravac.rozhlas.cz/audio/3421320', + 'md5': '504c902dbc9e9a1fd50326eccf02a7e2', + 'info_dict': { + 'id': '3421320', + 'ext': 'mp3', + 'title': 'Echo Pavla Klusáka (30.06.2015 21:00)', + 'description': 'Osmdesátiny Terryho Rileyho jsou skvělou příležitostí proletět se elektronickými i akustickými díly zakladatatele minimalismu, který je aktivní už přes padesát let' + } + } + + def _real_extract(self, url): + audio_id = self._match_id(url) + webpage = self._download_webpage(url, audio_id) + + title = self._html_search_regex(r'<h3>(.+?)</h3>', webpage, 'title') + description = self._html_search_regex(r'<p title="(.+?)">', webpage, 'description', fatal=False) + + url = 'http://media.rozhlas.cz/_audio/' + audio_id + '.mp3' + + return { + 'id': audio_id, + 'url': url, + 'title': title, + 'description': description, + } |