check if workaroundTokens is None before splitting

This commit is contained in:
xnand-dot-xyz
2025-09-12 15:35:40 +00:00
parent fcc36e6a68
commit 7791b56419

View File

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