add Twitch mime parser

This commit is contained in:
geeseven
2019-06-18 18:56:33 +00:00
parent 1784f10d0b
commit 9a8f717b37

View File

@@ -320,6 +320,16 @@ class StreamableMIMEParser(OpenGraphMIMEParser):
"""
pattern = re.compile(r'https?://(www\.)?streamable\.com/[^.]+$')
class TwitchMIMEParser(BaseMIMEParser):
"""
Twitch 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?://(clips|go|m|player|www)\.?twitch\.tv/[^.]+$')
@staticmethod
def get_mimetype(url):
return url, 'video/x-youtube'
class LiveleakMIMEParser(BaseMIMEParser):
"""
@@ -479,6 +489,7 @@ parsers = [
GiphyMIMEParser,
ImgflipMIMEParser,
LivememeMIMEParser,
TwitchMIMEParser,
MakeamemeMIMEParser,
WorldStarHipHopMIMEParser,
GifvMIMEParser,