Merge pull request #285 from xnand-dot-xyz/main

Fix getUserData when workaroundTokens is unset
This commit is contained in:
Dylan
2025-09-17 18:34:16 +01:00
committed by GitHub

View File

@@ -286,14 +286,18 @@ def getTweetData(twitter_url,include_txt="false",include_rtf="false"):
return tweetData
def getUserData(twitter_url,includeFeed=False):
rawUserData = twExtract.extractUser(twitter_url,workaroundTokens=config['config']['workaroundTokens'].split(','))
if config['config']['workaroundTokens'] is not None:
workaroundTokens = config['config']['workaroundTokens'].split(",")
else:
workaroundTokens = None
rawUserData = twExtract.extractUser(twitter_url,workaroundTokens=workaroundTokens))
userData = getApiUserResponse(rawUserData)
if includeFeed:
if userData['protected']:
userData['latest_tweets']=[]
else:
feed = twExtract.extractUserFeedFromId(userData['id'],workaroundTokens=config['config']['workaroundTokens'].split(','))
feed = twExtract.extractUserFeedFromId(userData['id'],workaroundTokens=workaroundTokens))
apiFeed = []
for tweet in feed:
apiFeed.append(getApiResponse(tweet))