From b657ae007666e43ead01e98d13b438f8161ea349 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 24 Sep 2025 21:44:41 +0100 Subject: [PATCH] Return to using extractStatusV2Anon --- twExtract/__init__.py | 2 +- vxApi.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/twExtract/__init__.py b/twExtract/__init__.py index ddfc403..8f2c213 100644 --- a/twExtract/__init__.py +++ b/twExtract/__init__.py @@ -495,7 +495,7 @@ def fixTweetData(tweet): def extractStatus(url,workaroundTokens=None): # TODO: commented out methods are too slow/unreliable at the moment - methods=[extractStatus_syndication,extractStatusV2]#,extractStatusV2Android,extractStatusV2TweetDetail] # + methods=[extractStatusV2Anon,extractStatusV2]#,extractStatusV2Android,extractStatusV2TweetDetail] # for method in methods: try: result = method(url,workaroundTokens) diff --git a/vxApi.py b/vxApi.py index c34acf7..89b2ac7 100644 --- a/vxApi.py +++ b/vxApi.py @@ -23,9 +23,10 @@ def getApiUserResponse(user): def getApiResponse(tweet,include_txt=False,include_rtf=False): tweetL = tweet["legacy"] if "user_result" in tweet["core"]: - userL = tweet["core"]["user_result"]["result"]["legacy"] + user = tweet["core"]["user_result"]["result"] elif "user_results" in tweet["core"]: - userL = tweet["core"]["user_results"]["result"]["legacy"] + user = tweet["core"]["user_results"]["result"] + userL = user["legacy"] media=[] media_extended=[] hashtags=[] @@ -33,6 +34,14 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False): oldTweetVersion = False tweetArticle=None lang=None + + if "screen_name" not in userL: + userL["screen_name"] = user["core"]["screen_name"] + if "name" not in userL: + userL["name"] = user["core"]["name"] + if "profile_image_url_https" not in userL: + userL["profile_image_url_https"] = user["avatar"]["image_url"] + #editedTweet=False try: if "birdwatch_pivot" in tweet: