Fix gfycat mime parser

This commit is contained in:
Michael Lazar
2019-02-02 21:56:26 -05:00
parent 9847932ff5
commit 6796ee7415
5 changed files with 237 additions and 238 deletions

View File

@@ -110,8 +110,8 @@ class GfycatMIMEParser(BaseMIMEParser):
@staticmethod
def get_mimetype(url):
parts = url.replace('gifs/detail/', '').split('/')
api_url = '/'.join(parts[:-1] + ['cajax', 'get'] + parts[-1:])
identifier = url.split('/')[-1]
api_url = 'https://api.gfycat.com/v1/gfycats/{}'.format(identifier)
resp = requests.get(api_url)
image_url = resp.json()['gfyItem']['mp4Url']
return image_url, 'video/mp4'