我正在尝试使用此代码从我的帐户中删除550条推文,因为我想再次使用它作为我的个人帐户,而不是来自我的机器人的推文:
import tweepy
import json
auth = tweepy.OAuthHandler("consumer_key", "consumer_secret")
auth.set_access_token("access_token", "access_token_secret")
api = tweepy.API(auth)
screen_name = "YOUR_TWITTER_HANDLE"
timelines = api.user_timeline(screen_name, count = 550, include_rts = False)
for status in timelines:
tweetid = status._json
api.destroy_status(tweetid)但是每次我运行它的时候,我都会得到这样的错误:
tweepy.error.TweepError: [{'message': 'Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform', 'code': 261}]当我打印tweetid时,它成功地抓取了我所有的tweet。我也可以正常地使用api.update_status发推文,但为什么这不起作用呢?我做错了什么?
发布于 2020-09-08 18:35:48
听起来你的API键被限制了(如果你试图执行太多的自动化操作,就会发生这种情况,请参阅自动化规则https://help.twitter.com/en/rules-and-policies/twitter-automation)。您需要通过https://help.twitter.com/forms/automation恢复应用程序
发布于 2020-09-08 11:20:17
看起来你已经向twitter api发出了很多请求--在我的小研究中,错误代码261意味着令牌被挂起了。请查看以下链接:
Why is the twitter API throwing this error?
https://blog.cotten.io/common-twitter-error-codes-6b324396042e
https://stackoverflow.com/questions/63786542
复制相似问题