Fixed direct video linking

This commit is contained in:
Dylan 2022-05-26 16:48:24 +01:00
parent ec1f4dc284
commit 728785278b

View file

@ -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