转发我的推文

时间:2017-09-06 14:39:56

标签: python python-3.x twitter twitter-oauth tweepy

所以我试图用tweepy

找出推文的转推
# 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]

我知道为什么这不能解决这个问题,而且考虑到我的帐户中没有有限的推文和转推,我需要遵循以获取推文的所有转发数据。

1 个答案:

答案 0 :(得分:1)

要查找用户从时间轴上获取每条推文的转推数量,请尝试以下代码:

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

要编辑正在搜索的用户,请更改" screen_name"到您要搜索的人的用户名。要更改状态数,请更改" count"。

您还可以使用以下方式打印信息,例如正在搜索的推文的推文ID:

print(tweet.id)
相关问题