Search code examples
pythontwittertweepyfavorites

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)

Error : Traceback (most recent call last): File "C:/Python34/fav.py", line 19, in tweet_list=api.favorites.list(screen_name="your_username", count=10) AttributeError: 'function' object has no attribute 'list'


Solution

  • From 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

    So you had it almost right, I'm not sure where you got the list method from but remove it and you'll get the list of tweets you want:

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