diff --git a/twitfix.py b/twitfix.py index 3418b3e..d89ac92 100644 --- a/twitfix.py +++ b/twitfix.py @@ -118,10 +118,12 @@ def twitfix(sub_path): print(request.url) if request.url.startswith("https://d.vx"): # Matches d.fx? Try to give the user a direct link + if match.start() == 0: + twitter_url = "https://twitter.com/" + 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 dl(sub_path) + return redirect(direct_video_link(twitter_url),302) else: return message("To use a direct MP4 link in discord, remove anything past '?' and put '.mp4' at the end") else: @@ -146,7 +148,7 @@ def twitfix(sub_path): else: clean = twitter_url - return dl(clean) + return redirect(direct_video_link(clean),302) # elif request.url.endswith(".json") or request.url.endswith("%2Ejson"): # twitter_url = "https://twitter.com/" + sub_path