您的代码存在一些问题,包括一些多余的导入。特别是,你不需要
import twitter和
importtweepy-
tweepy能够处理你所需要的一切。您遇到的特定问题是分页之一,可以
tweepy使用如下
Cursor对象来处理:
import tweepy# Consumer keys and access tokens, used for OAuthconsumer_key = ''consumer_secret = ''access_token = ''access_token_secret = ''# OAuth process, using the keys and tokensauth = tweepy.OAuthHandler(consumer_key, consumer_secret)auth.set_access_token(access_token, access_token_secret)# Creation of the actual interface, using authenticationapi = tweepy.API(auth)for status in tweepy.Cursor(api.user_timeline, screen_name='@realDonaldTrump', tweet_mode="extended").items(): print(status.full_text)



