This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 278
add Twitch mime parser #694
Labels
Comments
I think it would be helpful to have examples of all the possible Twitch URLs. |
I am currently using the following regex: https?://(clips\.|www\.|m\.)?twitch\.tv/[^.]+$ |
Looking over the current Twitch extractor for youtube-dl, looks like we would also need to add the |
Given #696, it does not make sense to submit a pull request. For anyone interested, here is what I did: $ git diff rtv/mime_parsers.py
diff --git a/rtv/mime_parsers.py b/rtv/mime_parsers.py
index 9d7eae8..3a51444 100644
--- a/rtv/mime_parsers.py
+++ b/rtv/mime_parsers.py
@@ -320,6 +320,17 @@ 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 +490,7 @@ parsers = [
GiphyMIMEParser,
ImgflipMIMEParser,
LivememeMIMEParser,
+ TwitchMIMEParser,
MakeamemeMIMEParser,
WorldStarHipHopMIMEParser,
GifvMIMEParser,
|
Hi geeseven, I have a fork of rtv called tuir on Gitlab here and I would love to include your code here if you submit a pull request over there |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is your feature request related to a problem? Please describe.
Twitch streams or clips act differently than other video links as they can only be opened in a browser.
Describe the solution you'd like
It would be nice to launch mpv or vlc for Twitch streams or clips.
Describe alternatives you've considered
Copy/paste is a workaround.
Additional context
Seeing that youtube-dl has support for Twitch, I have a working branch that uses 'video/x-youtube' like Vimeo. I would be more than happy to make a pull request.
The text was updated successfully, but these errors were encountered: