Just a few days ago the music part of my bot started returning this error when I tried searching YouTube:
Unhandled Promise Rejection:
Error: Status code: 429
at ClientRequest.httpLib.get (/rbd/pnpm-volume/aeb2f0e1-7782-4db6-b0c1-f46003ee3ac3/node_modules/.registry.npmjs.org/miniget/1.5.3/node_modules/miniget/lib/index.js:130:19)
at Object.onceWrapper (events.js:277:13)
at ClientRequest.emit (events.js:189:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at TLSSocket.socketOnData (_http_client.js:442:20)
at TLSSocket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at TLSSocket.Readable.push (_stream_readable.js:220:10)
Hereunder the code. The API key is valid and I didn’t change the code when this started.
const opts = {
maxResults: 3,
key: 'youtube api key',
type: 'video'
};
// Search youtube with youtube-search package
searchyt(args.join(' '), opts, function(err, res) {
if (err) return message.channel.send("An error occured. Please try again.\n`" + err + "`");
if (!res[0]) return message.channel.send(`I could not get a search result for \`${args[0]}\`.`);
// ...
});
note: the project is called tullibee