skip to Main Content

I would like to find public users on Twitter that have 0 followers. I was thinking of using https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search, but this doesn’t have a way to filter by number of followers. Are there any simple alternatives? (Otherwise, I might have to resort to using a graph/search based approach starting from a random point)

2

Answers


  1. Chosen as BEST ANSWER

    Bird SQL by Perplexity AI allows you to do this simply: https://www.perplexity.ai/sql

    Query: Users with 0 followers, and 0 following, with at least 5 tweets

    SELECT user_url, full_name, followers_count, following_count, tweet_count
    FROM users
    WHERE (followers_count = 0)
      AND (following_count = 0)
      AND (tweet_count >= 5)
    ORDER BY tweet_count DESC
    LIMIT 10
    

  2. Well you didn’t specify what library you are using to interact with the Twitter API. But regardless of which technology you’re using, the underlying concept is the same. I will use tweepy library in python for my example.

    Start by getting the public users using this. The return type is a list of user objects. The user object has several attributes which you can learn about here. For now we are interested in the followers_count attribute. Simply loop through the objects returned and check where the value of this attribute is 0.

    Here’s how the implementation would look like in python using tweepy library;

    search_query = 'your search query here'
    get_users = api.search_users(q = search_query)#Returns a list of user objects
    for users in get_users:
        if users.followers_count ==0:
            #Do stuff if the user has 0 followers
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search