Fix embedding issue on certain tweets

This commit is contained in:
Dylan 2023-07-16 01:35:03 +01:00
parent 163ae08cf8
commit 2eb4cfef34

View File

@ -133,12 +133,12 @@ def extractStatusV2(url):
tweetEntry=None tweetEntry=None
for entry in entries: for entry in entries:
result = entry['result'] result = entry['result']
if '__typename' in result and result['__typename'] == 'TweetWithVisibilityResults':
result=result['tweet']
if 'rest_id' in result and result['rest_id'] == twid: if 'rest_id' in result and result['rest_id'] == twid:
tweetEntry=result tweetEntry=result
break break
tweet=tweetEntry tweet=tweetEntry
if '__typename' in tweet and tweet['__typename'] == 'TweetWithVisibilityResults':
tweet=tweet['tweet']
except Exception as e: except Exception as e:
continue continue
return tweet return tweet
@ -161,8 +161,7 @@ def extractStatusV2Legacy(url):
return tweet['legacy'] return tweet['legacy']
def extractStatus(url): def extractStatus(url):
#methods=[extractStatus_guestToken,extractStatus_syndication,extractStatus_token,extractStatusV2Legacy] methods=[extractStatus_guestToken,extractStatus_syndication,extractStatus_token,extractStatusV2Legacy]
methods=[extractStatus_syndication,extractStatusV2Legacy]
for method in methods: for method in methods:
try: try:
return method(url) return method(url)