Python 使用Tweepy获取追随者信息

Python 使用Tweepy获取追随者信息,python,tweepy,ratelimit,Python,Tweepy,Ratelimit,我使用下面的代码获得了一个列表中的所有追随者ID。现在我想获得所有这些ID的信息(追随者计数,朋友计数,验证,等等)。为了每15分钟获得18000个结果,我需要做哪些更改。我用下面的代码在15分钟内得到了75000个ID counter = 0 reset_counter = 0 loop_counter = True backoff_timer = 2 # counter for timer while loop_counter: try: for friend in

我使用下面的代码获得了一个列表中的所有追随者ID。现在我想获得所有这些ID的信息(
追随者计数
朋友计数
验证
,等等)。为了每15分钟获得18000个结果,我需要做哪些更改。我用下面的代码在15分钟内得到了75000个ID

counter = 0
reset_counter = 0
loop_counter = True
backoff_timer = 2 # counter for timer

while loop_counter:
    try:
        for friend in tweepy.Cursor(api.followers_ids, id='adl440', count=5000).items():
            time.sleep(0.01)
            reset_counter += 1 # reser 1
            # this is reducing the waiting time

            counter += 1 #count 1
            # max collection 5*15K =75K in 15 mins
            # insert the information into the table
            #uid_json = {'uid': friend}
            #collection.insert_one(uid_json)
            # # saving the txt file
            
            print(str(friend))
            csvWriter.writerow(str(friend))
            count +=1
            print(count)

        break

    except tweepy.TweepError as err:
        print(err.reason)
        time.sleep(60 * backoff_timer)
        sleep_time = 60 * backoff_timer
        print('Error Generated by Tweepy API sleep {0} seconds.'.format(round(sleep_time,2)))
        backoff_timer += 1
        continue

我尝试使用API查找方法获取数据,但没有成功。每次尝试时,我在输出中得到的结果都非常少,并且突然达到了速率限制。

使用的TwitterAPI端点每个请求返回100个用户。端点的速率限制为900个请求/15分钟(使用用户身份验证),300个请求/15分钟(使用应用身份验证)。这意味着您应该能够在每15分钟的窗口中检索30000或90000个用户,这取决于您使用的是app auth还是user auth。

tweepy可能有一些限制。您需要使用一些第三方应用程序,或者尝试使用selenium自动化该过程。(不使用任何官方API的web报废)Tweepy本身并没有费率限制。Tweepy使用的Twitter API端点有速率限制。另外,在不使用官方API的情况下抓取Twitter也违反了规定。我应该如何修改此代码以获取如此多的数据?通过调用
API.lookup\u users
,每次使用100个ID