VOOZH about

URL: https://www.geeksforgeeks.org/python/python-tweepy-getting-the-number-of-tweets-a-user-has-liked/

⇱ Python Tweepy – Getting the number of tweets a user has liked - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python Tweepy – Getting the number of tweets a user has liked

Last Updated : 18 Jun, 2020
In this article we will see how we can get number of statuses/tweets a user has liked/favourited. The favourites_count attribute provides us with an integer which denotes the number of statuses the user has favourited.
In order to get the number of statuses the user has favourited, we have to do the following :
  1. Identify the user ID or the screen name of the profile.
  2. Get the User object of the profile using the get_user() method with the user ID or the screen name.
  3. From this object, fetch the favourites_count attribute present in it.
Example 1: Consider the following profile : 👁 Image
We will use the user ID to fetch the user. The user ID of the above mentioned profile is 57741058. Output :
The number of tweets the user has liked are : 483
Example 2: Consider the following profile : 👁 Image
We will use the screen name to fetch the user. The screen name of the above mentioned profile is PracticeGfG.
Output :
The number of tweets the user has liked are : 0
Comment
Article Tags:
Article Tags: