【问题标题】:Retweets of my tweets转发我的推文
【发布时间】:2018-02-15 02:46:50
【问题描述】:

所以我正在尝试使用 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]

知道为什么这不起作用,以及考虑到我的帐户中没有有限的推文和转发,我需要遵循什么来获取我的推文的所有转发数据。

【问题讨论】:

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


    【解决方案1】:

    要从用户的时间线中查找用户在每条推文上获得的转发次数,请尝试以下代码:

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

    要编辑正在搜索的用户,请将“screen_name”更改为您要搜索的人的用户名。改变状态的数量就是改变“计数”。

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

    print(tweet.id)
    

    【讨论】:

      猜你喜欢
      • 2019-11-27
      • 2014-10-13
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 2014-11-28
      • 1970-01-01
      • 2022-01-05
      • 2014-01-16
      相关资源
      最近更新 更多