From 1a13940c8dada638f8298b6c1406f38d4a3bf270 Mon Sep 17 00:00:00 2001 From: John Boehr Date: Wed, 18 Feb 2015 18:12:48 -0800 Subject: [PATCH] [imgur] support regular URL --- youtube_dl/extractor/imgur.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/imgur.py b/youtube_dl/extractor/imgur.py index 16488e0c4..8449c45f4 100644 --- a/youtube_dl/extractor/imgur.py +++ b/youtube_dl/extractor/imgur.py @@ -7,11 +7,11 @@ from ..utils import ( int_or_none, js_to_json, mimetype2ext, + ExtractorError, ) - class ImgurIE(InfoExtractor): - _VALID_URL = r'https?://i\.imgur\.com/(?P[a-zA-Z0-9]+)\.(?:mp4|gifv)' + _VALID_URL = r'https?://(?:i\.)?imgur\.com/(?P[a-zA-Z0-9]+)(?:\.)?(?:mp4|gifv)?' _TESTS = [{ 'url': 'https://i.imgur.com/A61SaA1.gifv', @@ -21,12 +21,25 @@ class ImgurIE(InfoExtractor): 'title': 'MRW gifv is up and running without any bugs', 'description': 'The Internet\'s visual storytelling community. Explore, share, and discuss the best visual stories the Internet has to offer.', }, + }, { + 'url': 'https://imgur.com/A61SaA1', + 'info_dict': { + 'id': 'A61SaA1', + 'ext': 'mp4', + 'title': 'MRW gifv is up and running without any bugs', + 'description': 'The Internet\'s visual storytelling community. Explore, share, and discuss the best visual stories the Internet has to offer.', + }, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) + sources = re.findall(r'