Skip to content

Commit b657ae0

Browse files
committed
Return to using extractStatusV2Anon
1 parent 433f015 commit b657ae0

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

twExtract/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def fixTweetData(tweet):
495495

496496
def extractStatus(url,workaroundTokens=None):
497497
# TODO: commented out methods are too slow/unreliable at the moment
498-
methods=[extractStatus_syndication,extractStatusV2]#,extractStatusV2Android,extractStatusV2TweetDetail] #
498+
methods=[extractStatusV2Anon,extractStatusV2]#,extractStatusV2Android,extractStatusV2TweetDetail] #
499499
for method in methods:
500500
try:
501501
result = method(url,workaroundTokens)

vxApi.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,25 @@ def getApiUserResponse(user):
2323
def getApiResponse(tweet,include_txt=False,include_rtf=False):
2424
tweetL = tweet["legacy"]
2525
if "user_result" in tweet["core"]:
26-
userL = tweet["core"]["user_result"]["result"]["legacy"]
26+
user = tweet["core"]["user_result"]["result"]
2727
elif "user_results" in tweet["core"]:
28-
userL = tweet["core"]["user_results"]["result"]["legacy"]
28+
user = tweet["core"]["user_results"]["result"]
29+
userL = user["legacy"]
2930
media=[]
3031
media_extended=[]
3132
hashtags=[]
3233
communityNote=None
3334
oldTweetVersion = False
3435
tweetArticle=None
3536
lang=None
37+
38+
if "screen_name" not in userL:
39+
userL["screen_name"] = user["core"]["screen_name"]
40+
if "name" not in userL:
41+
userL["name"] = user["core"]["name"]
42+
if "profile_image_url_https" not in userL:
43+
userL["profile_image_url_https"] = user["avatar"]["image_url"]
44+
3645
#editedTweet=False
3746
try:
3847
if "birdwatch_pivot" in tweet:

0 commit comments

Comments
 (0)