Skip to content

Commit

Permalink
[rozhlas] Add new extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
zvonicek authored and dstftw committed Aug 7, 2016
1 parent d21a661 commit e1f93a0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@
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
Expand Down
34 changes: 34 additions & 0 deletions youtube_dl/extractor/rozhlas.py
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit e1f93a0

Please sign in to comment.