Merge pull request #610 from mac1202/gfycat-mp4

Add mp4 support to gfycat.
This commit is contained in:
Michael Lazar
2018-09-25 13:22:10 -04:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ class VideoTagMIMEParser(BaseMIMEParser):
class GfycatMIMEParser(BaseMIMEParser):
"""
Gfycat provides a primitive json api to generate image links. URLs can be
downloaded as either gif, webm, or mjpg. Webm was selected because it's
downloaded as either gif, mp4, webm, or mjpg. Mp4 was selected because it's
fast and works with VLC.
https://gfycat.com/api
@@ -113,8 +113,8 @@ class GfycatMIMEParser(BaseMIMEParser):
parts = url.replace('gifs/detail/', '').split('/')
api_url = '/'.join(parts[:-1] + ['cajax', 'get'] + parts[-1:])
resp = requests.get(api_url)
image_url = resp.json()['gfyItem']['webmUrl']
return image_url, 'video/webm'
image_url = resp.json()['gfyItem']['mp4Url']
return image_url, 'video/mp4'
class YoutubeMIMEParser(BaseMIMEParser):

View File

@@ -27,8 +27,8 @@ URLS = OrderedDict([
None)),
('gfycat', (
'https://gfycat.com/DeliciousUnfortunateAdouri',
'https://giant.gfycat.com/DeliciousUnfortunateAdouri.webm',
'video/webm')),
'https://giant.gfycat.com/DeliciousUnfortunateAdouri.mp4',
'video/mp4')),
('youtube', (
'https://www.youtube.com/watch?v=FjNdYp2gXRY',
'https://www.youtube.com/watch?v=FjNdYp2gXRY',