aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/rozhlas.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
committerJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
commit27fe903c511691c078942bef5ee9a05a43b15c8f (patch)
tree50f30ab2ec749b965869518c0a28651f8677f0d3 /hypervideo_dl/extractor/rozhlas.py
downloadhypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.lz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.xz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.zip
initial
Diffstat (limited to 'hypervideo_dl/extractor/rozhlas.py')
-rw-r--r--hypervideo_dl/extractor/rozhlas.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/hypervideo_dl/extractor/rozhlas.py b/hypervideo_dl/extractor/rozhlas.py
new file mode 100644
index 0000000..fccf694
--- /dev/null
+++ b/hypervideo_dl/extractor/rozhlas.py
@@ -0,0 +1,50 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ remove_start,
+)
+
+
+class RozhlasIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?prehravac\.rozhlas\.cz/audio/(?P<id>[0-9]+)'
+ _TESTS = [{
+ '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'
+ }
+ }, {
+ 'url': 'http://prehravac.rozhlas.cz/audio/3421320/embed',
+ 'only_matching': True,
+ }]
+
+ def _real_extract(self, url):
+ audio_id = self._match_id(url)
+
+ webpage = self._download_webpage(
+ 'http://prehravac.rozhlas.cz/audio/%s' % audio_id, audio_id)
+
+ title = self._html_search_regex(
+ r'<h3>(.+?)</h3>\s*<p[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
+ webpage, 'title', default=None) or remove_start(
+ self._og_search_title(webpage), 'Radio Wave - ')
+ description = self._html_search_regex(
+ r'<p[^>]+title=(["\'])(?P<url>(?:(?!\1).)+)\1[^>]*>.*?</p>\s*<div[^>]+id=["\']player-track',
+ webpage, 'description', fatal=False, group='url')
+ duration = int_or_none(self._search_regex(
+ r'data-duration=["\'](\d+)', webpage, 'duration', default=None))
+
+ return {
+ 'id': audio_id,
+ 'url': 'http://media.rozhlas.cz/_audio/%s.mp3' % audio_id,
+ 'title': title,
+ 'description': description,
+ 'duration': duration,
+ 'vcodec': 'none',
+ }