如何使用 PYTHON TWEEPY 查找用户在推特上喜欢的所有推文 ID?
How to find all the tweet ids that a user has liked on twitter using PYTHON TWEEPY?
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", 计数=10)
AttributeError: 'function' 对象没有属性 'list'
来自Tweepy docs:
API.favorites([id][, page])
Returns the favorite statuses for the authenticating user or user specified by the ID parameter.
Parameters:
id
– The ID or screen name of the user to request favorites
page
– Specifies the page of results to retrieve. Note: there are pagination limits.
Return type:
- list of
Status
objects
所以你几乎是对的,我不确定你从哪里得到 list
方法但删除它,你会得到你想要的推文列表:
tweet_list = api.favorites(screen_name="your_username", count=10)
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", 计数=10) AttributeError: 'function' 对象没有属性 'list'
来自Tweepy docs:
API.favorites([id][, page])
Returns the favorite statuses for the authenticating user or user specified by the ID parameter.
Parameters:
id
– The ID or screen name of the user to request favorites
page
– Specifies the page of results to retrieve. Note: there are pagination limits.Return type:
- list of
Status
objects
所以你几乎是对的,我不确定你从哪里得到 list
方法但删除它,你会得到你想要的推文列表:
tweet_list = api.favorites(screen_name="your_username", count=10)