From: John Boehr Date: Thu, 19 Feb 2015 03:47:54 +0000 (-0800) Subject: [imgur] improve error check for non-video URLs X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=9e2d7dca87a15cf455fa6c4843a0241ba0b7ad77;p=youtube-dl [imgur] improve error check for non-video URLs --- 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({