Merge pull request #610 from mac1202/gfycat-mp4
Add mp4 support to gfycat.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user