This commit is contained in:
Dylan 2023-07-12 22:07:43 +01:00
parent 09ed116ca5
commit c775005227

View File

@ -104,12 +104,10 @@ def twitfix(sub_path):
image = ( int(request.url[-1]) - 1 )
return embed_video(clean, image)
elif True:
elif request.url.startswith("https://api.vx"):
twitter_url = "https://twitter.com/" + sub_path
try:
tweet = twExtract.extractStatusV2(twitter_url)
if '__typename' in tweet and tweet['__typename'] == 'TweetWithVisibilityResults':
tweet=tweet['tweet']
tweetL = tweet["legacy"]
userL = tweet["core"]["user_results"]["result"]["legacy"]
media=[]
@ -120,13 +118,12 @@ def twitfix(sub_path):
for i in tmedia:
if "video_info" in i:
# find the highest bitrate
highest = -1
besturl=""
highest = 0
for j in i["video_info"]["variants"]:
if j['content_type'] == "video/mp4" and j['bitrate'] > best_bitrate:
besturl = j['url']
best_bitrate = i['bitrate']
media.append(besturl)
if "bitrate" in j:
if j["bitrate"] > highest:
highest = j["bitrate"]
media.append(j["url"])
else:
media.append(i["media_url_https"])
if "hashtags" in tweetL["extended_entities"]: