fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.48k stars 790 forks source link

miniget 410 | Can't download video from YT Music #1150

Open gorgulenkozxc opened 1 year ago

gorgulenkozxc commented 1 year ago

Stack trace

/node_modules/miniget/dist/index.js:206
let err = new Miniget.MinigetError(`Status code: ${res.statusCode}`, res.statusCode);
          ^

MinigetError: Status code: 410
    at ClientRequest.<anonymous> (/home/user1/telegram/username/node_modules/miniget/dist/index.js:206:27)
    at Object.onceWrapper (node:events:642:26)
    at ClientRequest.emit (node:events:527:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:631:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:494:22)
    at TLSSocket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
Emitted 'error' event on PassThrough instance at:
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  statusCode: 410
}

Minimal trigger for error:

const ytdl = require('ytdl-core')
ytdl('K7fnAPU4hAY')

First of all:

Problem:

The title doesn't quite fit the real problem. It's not the subdomain music issue, but the issue of lack of video footage. If there is a video in the link, there is no error. So the question is, how do I download the music in this case?

Secreto31126 commented 1 year ago

I'm struggling with something similar.

I'm not getting the 410 response (the minimal trigger does work on my pc), but when I try to pipe the stream it downloads a file with no audio streams (checked with ffprobe).

The funny thing is, it only happens with Youtube Music videos. Any other type of video works just fine. Maybe it's just a mere coincidense, but the fact both issues are related to YT Music in the same period of time seems quite telling.

Maybe there's something going on in the backend of Youtube Music?

My minimal trigger

const fs = require("fs");
const ytdl = require("ytdl-core");

const ytmusic = fs.createWritableStream("./queen.mp4");
const notytm  = fs.createWritableStream("./playstation.mp4");

// YT Music (running "ffprobe -hide_banner ./queen.mp4" will show there is no audio stream, only a video stream)
ytdl("bdf_ll68Z8o").pipe(ytmusic).on("finish", () => console.log("Done YT Music"));

// Normal YT (ffprobe will show both audio and video streams for this one, and will work fine if you open it)
ytdl("4xM5xP2xMiI").pipe(notytm).on("finish", () => console.log("Done Normal YT"));
georgekarapi commented 1 year ago

Most probably is caused from ip rate limiting cutting down your bot. Restarting server and obtaining new ip worked for me

kevinmnm commented 1 year ago

I'm having same 410 error. It seems like it only occurs to certain YouTube videos (I don't exactly know why). I would love to see the fix for this.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.