From 9e2d7dca87a15cf455fa6c4843a0241ba0b7ad77 Mon Sep 17 00:00:00 2001 From: John Boehr Date: Wed, 18 Feb 2015 19:47:54 -0800 Subject: [PATCH] [imgur] improve error check for non-video URLs --- youtube_dl/extractor/imgur.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/imgur.py b/youtube_dl/extractor/imgur.py index 38c961773..7937a5c81 100644 --- a/youtube_dl/extractor/imgur.py +++ b/youtube_dl/extractor/imgur.py @@ -5,6 +5,7 @@ import re from .common import InfoExtractor from ..utils import ( int_or_none, + str_or_none, js_to_json, mimetype2ext, ExtractorError, @@ -35,11 +36,6 @@ class ImgurIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - sources = re.findall(r'(.*?)', - webpage, 'video elements') + webpage, 'video elements', fatal=False)) + if not video_elements: + raise ExtractorError( + 'No sources found for video %s' % video_id, expected=True) + formats = [] for m in re.finditer(r'[^"]+)"\s+type="(?P[^"]+)"', video_elements): formats.append({ -- 2.22.2