Add mime parser: vimeo.com

This commit is contained in:
woorst
2018-06-20 23:20:14 -04:00
parent 1275e1249b
commit d6a4cd0504
2 changed files with 17 additions and 0 deletions

View File

@@ -103,6 +103,18 @@ class YoutubeMIMEParser(BaseMIMEParser):
return url, 'video/x-youtube'
class VimeoMIMEParser(BaseMIMEParser):
"""
Vimeo videos can be streamed with vlc or downloaded with youtube-dl.
Assign a custom mime-type so they can be referenced in mailcap.
"""
pattern = re.compile(r'https?://(www\.)?vimeo\.com/\d+$')
@staticmethod
def get_mimetype(url):
return url, 'video/x-youtube'
class GifvMIMEParser(BaseMIMEParser):
"""
Special case for .gifv, which is a custom video format for imgur serves
@@ -502,6 +514,7 @@ parsers = [
RedditUploadsMIMEParser,
RedditVideoMIMEParser,
YoutubeMIMEParser,
VimeoMIMEParser,
LiveleakMIMEParser,
TwitchMIMEParser,
FlickrMIMEParser,

View File

@@ -134,6 +134,10 @@ URLS = OrderedDict([
'http://www.worldstarhiphop.com/videos/video.php?v=wshhJ6bVdAv0iMrNGFZG',
'http://www.youtube.com/embed/Bze53qwHS8o?autoplay=1',
'video/x-youtube')),
('vimeo', (
'https://vimeo.com/247872788',
'https://vimeo.com/247872788',
'video/x-youtube')),
])