oops
This commit is contained in:
parent
09ed116ca5
commit
c775005227
15
twitfix.py
15
twitfix.py
@ -104,12 +104,10 @@ def twitfix(sub_path):
|
|||||||
|
|
||||||
image = ( int(request.url[-1]) - 1 )
|
image = ( int(request.url[-1]) - 1 )
|
||||||
return embed_video(clean, image)
|
return embed_video(clean, image)
|
||||||
elif True:
|
elif request.url.startswith("https://api.vx"):
|
||||||
twitter_url = "https://twitter.com/" + sub_path
|
twitter_url = "https://twitter.com/" + sub_path
|
||||||
try:
|
try:
|
||||||
tweet = twExtract.extractStatusV2(twitter_url)
|
tweet = twExtract.extractStatusV2(twitter_url)
|
||||||
if '__typename' in tweet and tweet['__typename'] == 'TweetWithVisibilityResults':
|
|
||||||
tweet=tweet['tweet']
|
|
||||||
tweetL = tweet["legacy"]
|
tweetL = tweet["legacy"]
|
||||||
userL = tweet["core"]["user_results"]["result"]["legacy"]
|
userL = tweet["core"]["user_results"]["result"]["legacy"]
|
||||||
media=[]
|
media=[]
|
||||||
@ -120,13 +118,12 @@ def twitfix(sub_path):
|
|||||||
for i in tmedia:
|
for i in tmedia:
|
||||||
if "video_info" in i:
|
if "video_info" in i:
|
||||||
# find the highest bitrate
|
# find the highest bitrate
|
||||||
highest = -1
|
highest = 0
|
||||||
besturl=""
|
|
||||||
for j in i["video_info"]["variants"]:
|
for j in i["video_info"]["variants"]:
|
||||||
if j['content_type'] == "video/mp4" and j['bitrate'] > best_bitrate:
|
if "bitrate" in j:
|
||||||
besturl = j['url']
|
if j["bitrate"] > highest:
|
||||||
best_bitrate = i['bitrate']
|
highest = j["bitrate"]
|
||||||
media.append(besturl)
|
media.append(j["url"])
|
||||||
else:
|
else:
|
||||||
media.append(i["media_url_https"])
|
media.append(i["media_url_https"])
|
||||||
if "hashtags" in tweetL["extended_entities"]:
|
if "hashtags" in tweetL["extended_entities"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user