【问题标题】:I am getting 404 error on ytdl-core package我在 ytdl-core 包上收到 404 错误
【发布时间】:2021-09-07 01:39:28
【问题描述】:

当我尝试在 ytdl-core 中从 YouTube 提取音乐时,我在控制台上收到 404 错误。此错误来自 miniget 包。 ytdl-core 正在使用 miniget。

代码:

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

控制台:

(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)

如何解决?

【问题讨论】:

  • 据我所知,404是用来表示“Not Found”错误的,可能是stream.id添加到"https://www.youtube.com/watch?v="后形成的URL不会导致一个有效的youtube视频。跨度>

标签: node.js discord discord.js ytdl


【解决方案1】:

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

据我所知,Youtube 更新了 API,ytdl 需要更新才能使用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-21
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    • 2019-11-04
    • 2021-08-03
    • 1970-01-01
    • 2020-01-04
    相关资源
    最近更新 更多