From 913bfc8c8799b28d0c7743faaaccebff18d90d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Viemer=C3=B6?= Date: Mon, 5 Mar 2018 20:18:16 +0200 Subject: [PATCH 1/3] Don't stop processing URLs Use `continue` instead of `return` to loop through all possible sources. Added test case for episode where `` element has `[NOT-USED]` in URL, but other `<*Files>` elements have working URLs. --- youtube_dl/extractor/ruutu.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/ruutu.py b/youtube_dl/extractor/ruutu.py index 6c09df25a..aace634c3 100644 --- a/youtube_dl/extractor/ruutu.py +++ b/youtube_dl/extractor/ruutu.py @@ -15,6 +15,19 @@ from ..utils import ( class RuutuIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:ruutu|supla)\.fi/(?:video|supla)/(?P\d+)' _TESTS = [ + { + 'url': 'http://www.ruutu.fi/video/3193728', + 'md5': '285a06ce136bc4fdb4d48b02bf3ce5f6', + 'info_dict': { + 'id': '3193728', + 'ext': 'mp4', + 'title': 'Poliisit - Kausi 10 - Jakso 11', + 'description': 'md5:5154e593a0a138baeeb1caaabcbe13cb', + 'thumbnail': r're:^https?://.*\.jpg$', + 'duration': 1283, + 'age_limit': 0, + }, + }, { 'url': 'http://www.ruutu.fi/video/2058907', 'md5': 'ab2093f39be1ca8581963451b3c0234f', @@ -72,7 +85,7 @@ class RuutuIE(InfoExtractor): video_url = child.text if (not video_url or video_url in processed_urls or any(p in video_url for p in ('NOT_USED', 'NOT-USED'))): - return + continue processed_urls.append(video_url) ext = determine_ext(video_url) if ext == 'm3u8': From 82333476133e72c64f48b6b13b1cd2278d013737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Viemero=CC=88?= Date: Mon, 5 Mar 2018 20:57:51 +0200 Subject: [PATCH 2/3] Document and move test --- youtube_dl/extractor/ruutu.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/youtube_dl/extractor/ruutu.py b/youtube_dl/extractor/ruutu.py index aace634c3..c8409ef5b 100644 --- a/youtube_dl/extractor/ruutu.py +++ b/youtube_dl/extractor/ruutu.py @@ -15,19 +15,6 @@ from ..utils import ( class RuutuIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:ruutu|supla)\.fi/(?:video|supla)/(?P\d+)' _TESTS = [ - { - 'url': 'http://www.ruutu.fi/video/3193728', - 'md5': '285a06ce136bc4fdb4d48b02bf3ce5f6', - 'info_dict': { - 'id': '3193728', - 'ext': 'mp4', - 'title': 'Poliisit - Kausi 10 - Jakso 11', - 'description': 'md5:5154e593a0a138baeeb1caaabcbe13cb', - 'thumbnail': r're:^https?://.*\.jpg$', - 'duration': 1283, - 'age_limit': 0, - }, - }, { 'url': 'http://www.ruutu.fi/video/2058907', 'md5': 'ab2093f39be1ca8581963451b3c0234f', @@ -66,6 +53,22 @@ class RuutuIE(InfoExtractor): 'age_limit': 0, }, }, + # Episode where is "NOT-USED", but has other + # downloadable sources available. + { + 'url': 'http://www.ruutu.fi/video/3193728', + 'md5': '285a06ce136bc4fdb4d48b02bf3ce5f6', + 'info_dict': { + 'id': '3193728', + 'ext': 'mp4', + 'title': 'Poliisit - Kausi 10 - Jakso 11', + 'description': 'md5:5154e593a0a138baeeb1caaabcbe13cb', + 'thumbnail': r're:^https?://.*\.jpg$', + 'duration': 1283, + 'age_limit': 0, + }, + 'only_matching': True, + }, ] def _real_extract(self, url): From ab537fc1448f2d7066b29560ae2691e0efcb04bf Mon Sep 17 00:00:00 2001 From: Sergey M Date: Tue, 6 Mar 2018 01:59:48 +0700 Subject: [PATCH 3/3] Update ruutu.py --- youtube_dl/extractor/ruutu.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/youtube_dl/extractor/ruutu.py b/youtube_dl/extractor/ruutu.py index c8409ef5b..9fa8688f8 100644 --- a/youtube_dl/extractor/ruutu.py +++ b/youtube_dl/extractor/ruutu.py @@ -57,16 +57,6 @@ class RuutuIE(InfoExtractor): # downloadable sources available. { 'url': 'http://www.ruutu.fi/video/3193728', - 'md5': '285a06ce136bc4fdb4d48b02bf3ce5f6', - 'info_dict': { - 'id': '3193728', - 'ext': 'mp4', - 'title': 'Poliisit - Kausi 10 - Jakso 11', - 'description': 'md5:5154e593a0a138baeeb1caaabcbe13cb', - 'thumbnail': r're:^https?://.*\.jpg$', - 'duration': 1283, - 'age_limit': 0, - }, 'only_matching': True, }, ]