Merge pull request #565 from woorst/mime_parser_vimeo

Add mime parser: vimeo.com
This commit is contained in:
Michael Lazar
2018-06-24 18:33:59 -04:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -130,6 +130,18 @@ class YoutubeMIMEParser(BaseMIMEParser):
return url, 'video/x-youtube' 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): class GifvMIMEParser(BaseMIMEParser):
""" """
Special case for .gifv, which is a custom video format for imgur serves Special case for .gifv, which is a custom video format for imgur serves
@@ -537,6 +549,7 @@ parsers = [
RedditUploadsMIMEParser, RedditUploadsMIMEParser,
RedditVideoMIMEParser, RedditVideoMIMEParser,
YoutubeMIMEParser, YoutubeMIMEParser,
VimeoMIMEParser,
LiveleakMIMEParser, LiveleakMIMEParser,
TwitchMIMEParser, TwitchMIMEParser,
FlickrMIMEParser, FlickrMIMEParser,

View File

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