From cabe001590914338524dff0c1edffbde4a1447ab Mon Sep 17 00:00:00 2001 From: remitamine Date: Fri, 17 Jul 2015 16:18:33 +0100 Subject: [PATCH 1/4] [howstuffwoks] fix _VALID_URL regex --- youtube_dl/extractor/howstuffworks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/howstuffworks.py b/youtube_dl/extractor/howstuffworks.py index e973391213..f593931508 100644 --- a/youtube_dl/extractor/howstuffworks.py +++ b/youtube_dl/extractor/howstuffworks.py @@ -10,7 +10,7 @@ from ..utils import ( class HowStuffWorksIE(InfoExtractor): - _VALID_URL = r'https?://[\da-z-]+\.howstuffworks\.com/(?:[^/]+/)*\d+-(?P.+?)-video\.htm' + _VALID_URL = r'https?://[\da-z-]+\.howstuffworks\.com/(?:[^/]+/)*(\d+-)*(?P.+?)-video\.htm' _TESTS = [ { 'url': 'http://adventure.howstuffworks.com/5266-cool-jobs-iditarod-musher-video.htm', From f354385bf50e04b0e7e1defcc14264d1a66e0a07 Mon Sep 17 00:00:00 2001 From: remitamine Date: Fri, 17 Jul 2015 16:43:27 +0100 Subject: [PATCH 2/4] Add test for urls without a number --- youtube_dl/extractor/howstuffworks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/youtube_dl/extractor/howstuffworks.py b/youtube_dl/extractor/howstuffworks.py index f593931508..c9b6579a64 100644 --- a/youtube_dl/extractor/howstuffworks.py +++ b/youtube_dl/extractor/howstuffworks.py @@ -46,6 +46,17 @@ class HowStuffWorksIE(InfoExtractor): 'thumbnail': 're:^https?://.*\.jpg$', }, }, + { + 'url': 'http://shows.howstuffworks.com/stuff-to-blow-your-mind/optical-illusions-video.htm', + 'info_dict': { + 'id': '855410', + 'ext': 'mp4', + 'title': 'Stuff to Blow Your Mind', + 'description': 'When it comes to optical illusions it’s pretty easy to jailbreak the operating system of your mind and load a new program onto it. Find out why your visual system willingly makes errors in interpretation.', + 'display_id': 'optical-illusions', + 'thumbnail': 're:^https?://.*\.jpg$', + }, + } ] def _real_extract(self, url): From 1186e3f91ab940017be263c65c27b821992e58cc Mon Sep 17 00:00:00 2001 From: remitamine Date: Fri, 17 Jul 2015 16:45:53 +0100 Subject: [PATCH 3/4] do not capture a group --- youtube_dl/extractor/howstuffworks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/howstuffworks.py b/youtube_dl/extractor/howstuffworks.py index c9b6579a64..cc931d5711 100644 --- a/youtube_dl/extractor/howstuffworks.py +++ b/youtube_dl/extractor/howstuffworks.py @@ -10,7 +10,7 @@ from ..utils import ( class HowStuffWorksIE(InfoExtractor): - _VALID_URL = r'https?://[\da-z-]+\.howstuffworks\.com/(?:[^/]+/)*(\d+-)*(?P.+?)-video\.htm' + _VALID_URL = r'https?://[\da-z-]+\.howstuffworks\.com/(?:[^/]+/)*(?:\d+-)?(?P.+?)-video\.htm' _TESTS = [ { 'url': 'http://adventure.howstuffworks.com/5266-cool-jobs-iditarod-musher-video.htm', From c4fe07c7afcc59dfcd5cfa4626ad37deb19e1033 Mon Sep 17 00:00:00 2001 From: remitamine Date: Fri, 17 Jul 2015 17:07:55 +0100 Subject: [PATCH 4/4] match only the test url --- youtube_dl/extractor/howstuffworks.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/youtube_dl/extractor/howstuffworks.py b/youtube_dl/extractor/howstuffworks.py index cc931d5711..663e6632a1 100644 --- a/youtube_dl/extractor/howstuffworks.py +++ b/youtube_dl/extractor/howstuffworks.py @@ -48,14 +48,7 @@ class HowStuffWorksIE(InfoExtractor): }, { 'url': 'http://shows.howstuffworks.com/stuff-to-blow-your-mind/optical-illusions-video.htm', - 'info_dict': { - 'id': '855410', - 'ext': 'mp4', - 'title': 'Stuff to Blow Your Mind', - 'description': 'When it comes to optical illusions it’s pretty easy to jailbreak the operating system of your mind and load a new program onto it. Find out why your visual system willingly makes errors in interpretation.', - 'display_id': 'optical-illusions', - 'thumbnail': 're:^https?://.*\.jpg$', - }, + 'only_matching': True, } ]