几条推文后使用推文 ID 停止使用 tweepy 查找推文 - 用户暂停错误

Looking up tweets with tweepy using tweet ids stops after a few tweets - user suspended error

我有一个包含推文 ID 的数据集,我想使用 Tweepy 查找推文并将它们保存在 csv 文件中。

auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)

api = tweepy.API(auth, wait_on_rate_limit=True)

def get_tweet_text(tweet_id):
    tweet = api.get_status(tweet_id)
    return tweet.text

with open('NAACL_SRW_2016_cleaned.csv', 'a') as csvfile_clean:  
    writer = csv.writer(csvfile_clean, delimiter=';')
    writer.writerow(['ID', 'Form of Hate Speech', 'Tweet'])                 

    with open('NAACL_SRW_2016.csv') as csvfile:
        csv_reader: object = csv.reader(csvfile, delimiter=',')
        for row in csv_reader:
            id_of_tweet = (row[0])
            hate = (row[1])
            tweet = get_tweet_text(id_of_tweet)
            print(tweet)

            writer = csv.writer(csvfile_clean, delimiter=';')
            writer.writerow([id_of_tweet, hate, tweet])

代码工作正常,但在几条推文后停止,我收到以下错误消息。但是,我没有被停职——我的帐户上没有收到任何关于此的消息,我也仍然可以很好地流式传输推文。我尝试了不同的 IP 并重新生成了密钥,但我总是收到错误提示。有人经历过类似的事情吗?如果您有任何关于我可以尝试使其工作的提示,我将不胜感激。

So Drasko just said he was impressed the girls cooked half a chicken.. 
They cooked a whole one  #MKR
Drasko they didn't cook half a bird you idiot #mkr
Hopefully someone cooks Drasko in the next ep of #MKR
of course you were born in serbia...you're as fucked as A Serbian Film
These girls are the equivalent of the irritating Asian girls #MKR  
Lost the plot - where's the big Texan with the elephant sized steaks

tweepy.error.TweepError: [{'code': 63, 'message': 'User has been 
suspended.'}]

该错误表明撰写您正在搜索的推文的用户已被停权,而不是您已被停权。它是 tweepy api 为此处列出的错误代码 63 返回的值 https://developer.twitter.com/en/docs/basics/response-codes.html

Twitter 响应代码 sheet 表示代码 63 表示 The user account has been suspended and the information cannot be retrieved

您将无法使用 api 访问此信息。没有解决方法。