【问题标题】:How to find all the tweet ids that a user has liked on twitter using PYTHON TWEEPY?如何使用 PYTHON TWEEPY 在 Twitter 上找到用户喜欢的所有推文 ID?
【发布时间】:2018-04-29 01:55:04
【问题描述】:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
tweet_list=api.favorites.list(screen_name="your_username", count=10)

错误: 回溯(最近一次通话最后): 文件“C:/Python34/fav.py”,第 19 行,在 tweet_list=api.favorites.list(screen_name="your_username", count=10) AttributeError: 'function' 对象没有属性 'list'

【问题讨论】:

  • 使用tweet_list=api.favorites(screen_name="put_username_here", count=10)。删除list 属性,api.favoriteslist 形式返回结果
  • 非常感谢。你也能帮帮我吗?我在使用 twitter steaming API 时遇到了一些问题。它显示 tweet.retweeted = FALSE 表示实际上是转推的推文。
  • 你是如何调用流媒体 API 和推文的?我认为转发总是FALSE 没用你在请求时间线时使用include_my_retweet=1 参数,或者检查retweet_countgroups.google.com/d/msg/twitter-development-talk/exTRtbZmvro/…
  • 也检查这个类似的问题Twitter API: Check if a tweet is a retweet
  • new_tweets = api.user_timeline(screen_name = screen_name,count=200 , include_rts=True) 用于所有推文中的推文: print(tweet.retweeted) 我正在使用这种格式,并且每个推文都显示为 FALSE推文

标签: python twitter tweepy favorites


【解决方案1】:

来自Tweepy docs

API.favorites([id][, page])

返回身份验证用户或 ID 参数指定的用户的收藏状态。

参数:

  • id – 请求收藏的用户 ID 或屏幕名称

  • page – 指定要检索的结果页面。注意:有分页限制。

返回类型:

  • Status 对象列表

所以你几乎是对的,我不确定你从哪里得到 list 方法,但删除它,你会得到你想要的推文列表:

tweet_list = api.favorites(screen_name="your_username", count=10)

【讨论】:

    猜你喜欢
    • 2016-02-09
    • 2017-07-14
    • 1970-01-01
    • 2018-09-10
    • 2018-10-01
    • 2012-09-04
    • 2023-01-08
    • 1970-01-01
    • 2019-06-11
    相关资源
    最近更新 更多