【发布时间】:2021-01-27 02:19:22
【问题描述】:
我有一个 ID 超过 100 的推文列表,我想获取每条推文的所有转推 ID 我使用的代码用于一条推文 ID 我如何提供推文 ID 列表并检查是否有转推为这条推文打印用户 ID
# import the module
import tweepy
# assign the values accordingly
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
# authorization of consumer key and consumer secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# set access to user's access key and access secret
auth.set_access_token(access_token, access_token_secret)
# calling the api
api = tweepy.API(auth)
# the ID of the tweet
ID = 1265889240300257280
# getting the retweeters
retweets_list = api.retweets(ID)
# printing the screen names of the retweeters
for retweet in retweets_list:
print(retweet.user.screen_name)
谁能帮帮我?
【问题讨论】: