node.jsdiscorddiscord.jsytdl

I am getting 404 error on ytdl-core package


When I try to pull a music from YouTube in ytdl-core, I get a 404 error on the console. This error comes from the miniget package. ytdl-core is using miniget.

Code:

ytdl("https://www.youtube.com/watch?v=" + stream.id);

Console:

(node:16438) UnhandledPromiseRejectionWarning: Error: Status code: 404
    at ClientRequest.<anonymous> (/rbd/pnpm-volume/59a3a74b-3917-4637-83d3-08984c5b8ec9/node_modules/.registry.npmjs.org/miniget/4.2.1/node_modules/miniget/dist/index.js:210:27)
    at Object.onceWrapper (events.js:284:20)
    at ClientRequest.emit (events.js:196:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:23)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:17)
    at TLSSocket.socketOnData (_http_client.js:452:22)
    at TLSSocket.emit (events.js:196:13)
    at addChunk (_stream_readable.js:290:12)
    at readableAddChunk (_stream_readable.js:271:11)
    at TLSSocket.Readable.push (_stream_readable.js:226:10)
(node:16438) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

How can this be resolved?


Solution

  • https://github.com/fent/node-ytdl-core/issues/939#issuecomment-866241199

    Youtube updated API, ytdl needs an update to work with it, as far as I know.