From 1ec59bce2ea8a6543854fe24e4eeb738f4499794 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 17 Jul 2022 13:54:59 +0100 Subject: [PATCH] Fixed direct linking on Discord --- twitfix.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/twitfix.py b/twitfix.py index ef0b3e7..74b7b3c 100644 --- a/twitfix.py +++ b/twitfix.py @@ -71,7 +71,9 @@ def twitfix(sub_path): if user_agent in generate_embed_user_agents: print( " ➤ [ D ] d.vx link shown to discord user-agent!") if request.url.endswith(".mp4") and "?" not in request.url: - return redirect(direct_video_link(twitter_url),302) + # TODO: Cache this, but not for too long as disk space can fill up + vid = requests.get(direct_video_link(twitter_url)) + return Response(vid.content,mimetype="video/mp4") else: return message("To use a direct MP4 link in discord, remove anything past '?' and put '.mp4' at the end") else: