转发我的微博

2024-09-29 07:18:20 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我想用tweepy找出我的tweetpy的转发量

# To get first tweet
firstTweet = api.user_timeline("zzaibis")[0]

# then getting the retweet data using tweet id and it gives me the results 
resultsOfFirstTweet = api.retweets(firstTweet.id)

# but when I try to find any other tweet except first tweet, this returns nothing.
secondTweet = api.user_timeline("zzaibis")[1]

你知道为什么这不起作用吗?还有,考虑到我的帐户中没有有限的tweets和retweets,我需要遵循什么来获取我的tweets的所有转发数据吗。在


Tags: thetoapiidgettimelinetweetstweet
1条回答
网友
1楼 · 发布于 2024-09-29 07:18:20

若要查找用户在其时间轴上获得的每条tweet的转发数,请尝试以下代码:

for tweet in api.user_timeline(screen_name = 'StackOverflow', count = 10):
    print(tweet.retweet_count)

要编辑正在搜索的用户,请将“屏幕名称”更改为要搜索的用户的用户名。要改变状态的数量,就要改变“计数”。在

您还可以使用以下工具打印要搜索的tweet的tweet id等信息:

^{pr2}$

相关问题 更多 >