我有一个使用NPM Twit [https://www.npmjs.com/package/twit] 的JavaScript应用程序来发布推文到Twitter。我的机器人最近突然停止工作,没有任何解释或警告。Twitter似乎要求我从他们的旧免费套餐升级到他们的新免费套餐,这要求我删除我的Twitter开发帐户中的所有内容,然后重新创建我的项目和应用程序。我已经这样做了,并确保选择了读取和写入权限。
我的授权是有效的。当我运行twitClient.get('account/verify_credentials', {…})
时,我可以收到所有帐户详细信息。
但是有些东西阻止了我的代码发布推文。当我运行twitClient.post('statuses/update', {…}, function (error, success) {})
时,我收到以下消息:
Post to Twitter failure: Error: You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product
at exports.makeTwitError (/Users/…/node_modules/twit/lib/helpers.js:74:13)
at onRequestComplete (/Users/…/node_modules/twit/lib/twitter.js:344:25)
at Request.<anonymous> (/Users/…/node_modules/twit/lib/twitter.js:364:7)
at Request.emit (node:events:523:35)
at Gunzip.<anonymous> (/Users/…/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:625:28)
at Gunzip.emit (node:events:511:28)
at endReadableNT (node:internal/streams/readable:1367:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 453,
allErrors: [
{
message: 'You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product',
code: 453
}
],
twitterReply: { errors: [ [Object] ] },
statusCode: 403
}
我尝试将Twit更换为一些更新的东西,比如Twitter API V2[https://www.npmjs.com/package/twitter-api-v2],但是发推文的语法完全不同。
我尝试搜索答案,但我只找到了Python代码。