【问题标题】:Tweepy: How do you check if a tweet is favorited?Tweepy:你如何检查一条推文是否被收藏?
【发布时间】:2020-07-18 12:05:47
【问题描述】:

我可以检查一条推文是否被我转发,但不能检查一条推文是否被收藏。有什么解决办法吗?

except tweet.id(retweeted):
        ignore
    except tweet.id(???)
        ignore

【问题讨论】:

    标签: python tweepy


    【解决方案1】:
    id = 1272479136133627905
      
    # fetching the status 
    status = api.get_status(id) 
      
    # fetching the favorited attribute 
    favorited = status.favorited  
      
    if favorited == True: 
        print("The authenticated user has liked the tweet.") 
    else: 
        print("The authenticated user has not liked the tweet.")```
    

    【讨论】:

    • 忽略末尾的 3 个反引号 -_-
    • 还有id是状态的id,你自己输入
    猜你喜欢
    • 2015-10-06
    • 2018-10-07
    • 2014-02-17
    • 1970-01-01
    • 2017-04-12
    • 2011-07-09
    • 2013-03-29
    • 2018-09-03
    • 1970-01-01
    相关资源
    最近更新 更多