aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-01-21 17:40:00 +0700
committerSergey M․ <dstftw@gmail.com>2018-01-21 17:40:23 +0700
commitdf58ecbeba72e03b241c28e7c4760ef9b215c402 (patch)
tree10b57418a447253c3b116ee5d9b134e41bb69c61
parentac458e90a34f7ad93b797176c2c86c50f9ca23ee (diff)
[rtvs] Add extractor (closes #9242, closes #15187)
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/rtvs.py47
2 files changed, 48 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index f5bac6fd9..541f73e3c 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -900,6 +900,7 @@ from .rtp import RTPIE
from .rts import RTSIE
from .rtve import RTVEALaCartaIE, RTVELiveIE, RTVEInfantilIE, RTVELiveIE, RTVETelevisionIE
from .rtvnh import RTVNHIE
+from .rtvs import RTVSIE
from .rudo import RudoIE
from .ruhd import RUHDIE
from .ruleporn import RulePornIE
diff --git a/youtube_dl/extractor/rtvs.py b/youtube_dl/extractor/rtvs.py
new file mode 100644
index 000000000..6573b260d
--- /dev/null
+++ b/youtube_dl/extractor/rtvs.py
@@ -0,0 +1,47 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class RTVSIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv/\d+/(?P<id>\d+)'
+ _TESTS = [{
+ # radio archive
+ 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872',
+ 'md5': '134d5d6debdeddf8a5d761cbc9edacb8',
+ 'info_dict': {
+ 'id': '414872',
+ 'ext': 'mp3',
+ 'title': 'Ostrov pokladov 1 časť.mp3'
+ },
+ 'params': {
+ 'skip_download': True,
+ }
+ }, {
+ # tv archive
+ 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118',
+ 'md5': '85e2c55cf988403b70cac24f5c086dc6',
+ 'info_dict': {
+ 'id': '63118',
+ 'ext': 'mp4',
+ 'title': 'Amaro Džives - Náš deň',
+ 'description': 'Galavečer pri príležitosti Medzinárodného dňa Rómov.'
+ },
+ 'params': {
+ 'skip_download': True,
+ }
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, video_id)
+
+ playlist_url = self._search_regex(
+ r'playlist["\']?\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
+ 'playlist url', group='url')
+
+ data = self._download_json(
+ playlist_url, video_id, 'Downloading playlist')[0]
+ return self._parse_jwplayer_data(data, video_id=video_id)