是否可以按关注者数量搜索Twitter用户?

问题描述 投票:0回答:1

我想在Twitter上找到具有0个关注者的公共用户。我当时在考虑使用https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search,但是这种方法无法按关注者数量进行过滤。有没有其他简单的选择? (否则,我可能不得不从随机点开始使用基于图/搜索的方法)

twitter
1个回答
0
投票

您没有指定与Twitter API交互所使用的库。但是,无论您使用哪种技术,其基本概念都是相同的。我将在示例中使用python中的tweepy库。

[首先使用this吸引公共用户。返回类型是用户对象的列表。用户对象具有几个属性,您可以了解here。现在,我们对followerscount属性感兴趣。只需遍历返回的对象并检查此属性的值在哪里0。

这是使用tweepy库的实现在python中的外观;

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
© www.soinside.com 2019 - 2024. All rights reserved.