Twitter API 搜索未返回推文的全文

Twitter API search not returning full text of tweet

Right now my code is only returning some of the tweets

api = TwitterAPI(consumer_key, consumer_secret, access_key, access_secret)
r = api.request('tweets/search/fullarchive/:prod', {'query' : 'search term',"maxResults": "100",
"fromDate":"201901010000","toDate":"202001310000"})

csvFile = open('output.csv', 'a+')
csvWriter = csv.writer(csvFile)

for tweet in r:
    csvWriter.writerow([tweet['created_at'], tweet['user']['screen_name'], tweet['text'].encode('utf-8') if 'text' in tweet else tweet])

csvFile.close()

如果推文是扩展推文,请使用tweet['extended_tweet']['full_text']

并非所有推文都已扩展。所以,使用这样的测试:

if 'extended_tweet' in tweet: 
    print(tweet['extended_tweet']['full_text'])
else if 'text' in tweet:
    print(tweet['text'])