Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and access secret from twitter developer available easily for each user. These keys will help the API for authentication.
API.mutes_ids()
The mutes_ids()
method of the API
class in Tweepy module is used to get a list of all the users IDs of the users blocked by the authenticated user.
Syntax : API.mutes_ids()
Parameters : None
Returns : a list of Integers
Example 1 : Finding the number of users muted by the authenticated user using the mutes_ids()
method.
# import the module import tweepy # assign the values accordingly consumer_key = "" consumer_secret = "" access_token = "" access_token_secret = "" # authorization of consumer key and consumer secret auth = tweepy.OAuthHandler(consumer_key, consumer_secret) # set access to user's access key and access secret auth.set_access_token(access_token, access_token_secret) # calling the api api = tweepy.API(auth) # getting the muted users muted_users = api.mutes_ids() # printing the number of muted users print ( len (muted_users)) |
Output :
2
Example 2 : Finding the user IDs of all users muted by the authenticated user using the mutes_ids()
method.
# getting the muted users muted_users = api.mutes_ids() # printing the user IDs of the muted users for IDs in muted_users: print (IDs) |
Output :
4802800777 37222058
<!–
–>
Please Login to comment…