node-ytdl-core
node-ytdl-core copied to clipboard
Miniget Error: Status code: 410
I have noticed that an issue like this is happening and I've tried following through on what has been said to try and fix it.
async function playSong(guildID: string,song: Video): Promise<void> {
return new Promise<void>((resolve, reject) => {
let videoStream: internal.Readable | null = null;
try {
// Download the video
videoStream = ytdl(song.url,{
quality: "highestaudio",
dlChunkSize: 0,
requestOptions: {
headers: {
cookie: process.env.YT_COOKIE,
"x-youtube-identity-token": process.env.YT_TOKEN
}
}
});
} catch(err) { return reject(err); }
processVideo(videoStream)
.then((voiceData: Buffer) => {
const guildPlayer: AudioPlayer = guildAudioPlayers.ensure(guildID,() => createAudioPlayer());
const resource: AudioResource = createAudioResource(Readable.from([voiceData]));
try {
guildPlayer.play(resource);
resolve();
} catch(err) { return reject(err); }
})
.catch(err => reject(new Error("Failed to play song with error: " + err.message)));
});
}
This is where I'm using ytdl and from what I noticed when I try and play an age restricted/suicide topic song I get this output
[14:51:27] ERROR: Status code: 410
err: {
"type": "MinigetError",
"message": "Status code: 410",
"stack":
Error: Status code: 410
at ClientRequest.<anonymous> (E:\MyDev\_Projects\Discord\dscrd-TheDirector\node_modules\miniget\src\index.ts:255:19)
at Object.onceWrapper (node:events:628:26)
at ClientRequest.emit (node:events:513:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:542:22)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at TLSSocket.Readable.push (node:internal/streams/readable:234:10)
"statusCode": 410
}
For example trying to play: https://www.youtube.com/watch?v=yNjWAjXTryE
If I go to youtube manually and try and play this song I get the popup from youtube saying
The following content may contain suicide or self-harm topics. Viewer discretion is advised.
I understand and wish to proceed.
I read from another issue that doing the cookies would allow me to view this content and even after doing so I still receive the error above.
EDIT: I also tried the fix in #1080
const url: string = parseAgeYTUrl(song);
Logger.info("Getting song with url: " + url);
let info: ytdl.videoInfo | undefined = undefined;
try {
info = await ytdl.getBasicInfo(url,{
requestOptions: {
headers: {
cookie: process.env.YT_COOKIE,
"x-youtube-identity-token": process.env.YT_TOKEN
}
}
});
} catch(err) { Logger.error(err); }
function parseAgeYTUrl(input: string) {
return `${input}&bpctr=${Date.now()}&has_verified=1`;
}
Actually the fix from #1080 is something that must be done internally in the lib. If you want to try using my fork, which fixes this error and some others, put in your package.json:
"ytdl-core": "github:eugabrielsilva/node-ytdl-core"
Actually the fix from #1080 is something that must be done internally in the lib. If you want to try using my fork, which fixes this error and some others, put in your package.json:
"ytdl-core": "github:eugabrielsilva/node-ytdl-core"
Ok I'll try that out thank you
Actually the fix from #1080 is something that must be done internally in the lib. If you want to try using my fork, which fixes this error and some others, put in your package.json:
"ytdl-core": "github:eugabrielsilva/node-ytdl-core"
Legend, thank you for fixing it! I'll leave the issue open in hopes that the original repo will fix it too.
Actually the fix from #1080 is something that must be done internally in the lib. If you want to try using my fork, which fixes this error and some others, put in your package.json:
"ytdl-core": "github:eugabrielsilva/node-ytdl-core"
Hey again this is the only place where I can message you but I went away from my bot for a bit and just started working on it again and when trying to use your fork I get this output
S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\cache.js:29
let value = fn();
^
TypeError: utils.request is not a function
at S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\sig.js:19:28
at Cache.getOrSet (S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\cache.js:29:19)
at Object.exports.getFunctions (S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\sig.js:18:68)
at Object.exports.decipherFormats (S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\sig.js:166:33)
at exports.getInfo (S:\MyDev\_Projects\Discord\GeneralBot\node_modules\ytdl-core\lib\info.js:390:20)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Edit: I chose to go back to the specific commit github:eugabrielsilva/node-ytdl-core#f8b44b6727be87da46f6dbabc6f46e4efbd96436 and it works again so I believe it has to do with some recent change
Hey everyone, it seems like the fork isn't available anymore. Is there an alternative?
Yeah I just found that out too it really sucks
Actually the fix from #1080 is something that must be done internally in the lib. If you want to try using my fork, which fixes this error and some others, put in your package.json:
"ytdl-core": "github:eugabrielsilva/node-ytdl-core"
Is there a reason you removed your fork?
I'm running into this issue too. Any chance that the core library will fix this?
hey @bboynton97 @dev-syn @JenerNiklas, i deleted the fork because stopped working on it after i found a lot of new bugs... alternatively I've migrated to @distube/ytdl-core
hey @bboynton97 @dev-syn @JenerNiklas, i deleted the fork because stopped working on it after i found a lot of new bugs... alternatively I've migrated to
@distube/ytdl-core
Ah, thank you for this will migrate to this as well
any update? i still got thí error
any update? i still got thí error
found that @distube/ytdl-core
works