From 37505d70e5b73413e0280bf3aeb5775ff681e8f9 Mon Sep 17 00:00:00 2001 From: Milan Kral Date: Fri, 7 May 2021 10:56:52 +0200 Subject: [PATCH 1/2] [rtvs] Fixed extractor for Slovak television and radio. --- youtube_dl/extractor/rtvs.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/youtube_dl/extractor/rtvs.py b/youtube_dl/extractor/rtvs.py index 6573b260d..8d5634e28 100644 --- a/youtube_dl/extractor/rtvs.py +++ b/youtube_dl/extractor/rtvs.py @@ -8,8 +8,8 @@ class RTVSIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rtvs\.sk/(?:radio|televizia)/archiv/\d+/(?P\d+)' _TESTS = [{ # radio archive - 'url': 'http://www.rtvs.sk/radio/archiv/11224/414872', - 'md5': '134d5d6debdeddf8a5d761cbc9edacb8', + 'url': 'https://www.rtvs.sk/radio/archiv/11224/414872', + 'md5': 'f3d6f3fe74a4aaddafb3ff78b667dbd5', 'info_dict': { 'id': '414872', 'ext': 'mp3', @@ -20,8 +20,8 @@ class RTVSIE(InfoExtractor): } }, { # tv archive - 'url': 'http://www.rtvs.sk/televizia/archiv/8249/63118', - 'md5': '85e2c55cf988403b70cac24f5c086dc6', + 'url': 'https://www.rtvs.sk/televizia/archiv/8249/63118', + 'md5': '180dc795290ccddd916f7fa6440ce3c6', 'info_dict': { 'id': '63118', 'ext': 'mp4', @@ -38,10 +38,23 @@ class RTVSIE(InfoExtractor): webpage = self._download_webpage(url, video_id) - playlist_url = self._search_regex( - r'playlist["\']?\s*:\s*(["\'])(?P(?:(?!\1).)+)\1', webpage, - 'playlist url', group='url') + json_url = self._search_regex( + r'url\s*=\s*[\'"](?P//www.rtvs.sk/json/[^&"\']+)', webpage, + 'json url', group='url') - data = self._download_json( - playlist_url, video_id, 'Downloading playlist')[0] - return self._parse_jwplayer_data(data, video_id=video_id) + data = self._download_json('https:' + json_url, video_id) + + if json_url.find('audio') >= 0: + + playlist0 = data.get("playlist")[0] + title = playlist0.get("title") + url = playlist0.get('sources')[0].get('src') + return {'id': video_id, 'title': title, 'url': url} + + else: + + clip = data.get("clip") + description = clip.get("description") + title = clip.get("title") + url = clip.get("sources")[0].get('src') + return {'id': video_id, 'ext': 'mp4', 'title': title, 'description': description, 'url': url} From 9efd90dc27dd99af3ef9fabb3b441082b20ea6c4 Mon Sep 17 00:00:00 2001 From: Milan Kral Date: Tue, 25 May 2021 09:47:49 +0200 Subject: [PATCH 2/2] md5 sum of the first 10241 bytes --- youtube_dl/extractor/rtvs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/rtvs.py b/youtube_dl/extractor/rtvs.py index 8d5634e28..b3088f5e9 100644 --- a/youtube_dl/extractor/rtvs.py +++ b/youtube_dl/extractor/rtvs.py @@ -9,7 +9,7 @@ class RTVSIE(InfoExtractor): _TESTS = [{ # radio archive 'url': 'https://www.rtvs.sk/radio/archiv/11224/414872', - 'md5': 'f3d6f3fe74a4aaddafb3ff78b667dbd5', + 'md5': '134d5d6debdeddf8a5d761cbc9edacb8', 'info_dict': { 'id': '414872', 'ext': 'mp3', @@ -21,7 +21,7 @@ class RTVSIE(InfoExtractor): }, { # tv archive 'url': 'https://www.rtvs.sk/televizia/archiv/8249/63118', - 'md5': '180dc795290ccddd916f7fa6440ce3c6', + 'md5': '85e2c55cf988403b70cac24f5c086dc6', 'info_dict': { 'id': '63118', 'ext': 'mp4',