[imgur] fix

This commit is contained in:
Mort Yao 2020-09-20 17:05:47 +02:00
parent e0615e31e0
commit da1d772cd8
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -52,20 +52,16 @@ class Imgur(VideoExtractor):
else: else:
# gallery image # gallery image
content = get_content(self.url) content = get_content(self.url)
image = json.loads(match1(content, r'image\s*:\s*({.*}),')) url = match1(content, r'(https?://i.imgur.com/[^"]+)')
ext = image['ext'] _, container, size = url_info(url)
self.streams = { self.streams = {
'original': { 'original': {
'src': ['http://i.imgur.com/%s%s' % (image['hash'], ext)], 'src': [url],
'size': image['size'], 'size': size,
'container': ext[1:] 'container': container
},
'thumbnail': {
'src': ['http://i.imgur.com/%ss%s' % (image['hash'], '.jpg')],
'container': 'jpg'
} }
} }
self.title = image['title'] or image['hash'] self.title = r1(r'i\.imgur\.com/([^./]*)', url)
def extract(self, **kwargs): def extract(self, **kwargs):
if 'stream_id' in kwargs and kwargs['stream_id']: if 'stream_id' in kwargs and kwargs['stream_id']: