add vidme mime parser

This commit is contained in:
woorst
2017-05-31 15:57:39 -05:00
parent 84824f0352
commit b9849fe3d2
2 changed files with 20 additions and 0 deletions

View File

@@ -188,8 +188,24 @@ class InstagramMIMEParser(BaseMIMEParser):
return url, None
class VidmeMIMEParser(BaseMIMEParser):
"""
Vidme provides a json api.
https://doc.vid.me
"""
pattern = re.compile(r'https?://(www\.)?vid\.me/[^.]+$')
@staticmethod
def get_mimetype(url):
resp = requests.get('https://api.vid.me/videoByUrl?url=' + url)
video_url = resp.json()['video']['complete_url']
return video_url, 'video/mp4'
# Parsers should be listed in the order they will be checked
parsers = [
VidmeMIMEParser,
InstagramMIMEParser,
GfycatMIMEParser,
ImgurAlbumMIMEParser,