diff options
Diffstat (limited to 'yt_dlp/extractor/gfycat.py')
-rw-r--r-- | yt_dlp/extractor/gfycat.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/yt_dlp/extractor/gfycat.py b/yt_dlp/extractor/gfycat.py index 56a6dc03d..2ad03e2b2 100644 --- a/yt_dlp/extractor/gfycat.py +++ b/yt_dlp/extractor/gfycat.py @@ -1,6 +1,8 @@ # coding: utf-8 from __future__ import unicode_literals +import re + from .common import InfoExtractor from ..utils import ( int_or_none, @@ -11,7 +13,7 @@ from ..utils import ( class GfycatIE(InfoExtractor): - _VALID_URL = r'https?://(?:(?:www|giant|thumbs)\.)?gfycat\.com/(?:ru/|ifr/|gifs/detail/)?(?P<id>[^-/?#\.]+)' + _VALID_URL = r'(?i)https?://(?:(?:www|giant|thumbs)\.)?gfycat\.com/(?:ru/|ifr/|gifs/detail/)?(?P<id>[^-/?#\."\']+)' _TESTS = [{ 'url': 'http://gfycat.com/DeadlyDecisiveGermanpinscher', 'info_dict': { @@ -78,8 +80,19 @@ class GfycatIE(InfoExtractor): }, { 'url': 'https://giant.gfycat.com/acceptablehappygoluckyharborporpoise.mp4', 'only_matching': True + }, { + 'url': 'http://gfycat.com/IFR/JauntyTimelyAmazontreeboa', + 'only_matching': True }] + @staticmethod + def _extract_urls(webpage): + return [ + mobj.group('url') + for mobj in re.finditer( + r'<(?:iframe|source)[^>]+\bsrc=["\'](?P<url>%s)' % GfycatIE._VALID_URL, + webpage)] + def _real_extract(self, url): video_id = self._match_id(url) |