MinigetError: Status code: 410
using this package for more than year, suddenly it stopped working and getting this error while trying to get video info, that will be then used to get video captions
Error getting info for videoId: hTcRmj-XLEs MinigetError: Status code: 410
at ClientRequest.
let info;
try {
info = await ytdl.getInfo(videoId, { lang: clientLang });
} catch (error) {
console.error("Error getting info for videoId:", videoId, error);
return null;
}
if (info) {
const autoLangCode = detect(info.videoDetails.title);
console.log("autoLangCode found===> ,clientLang", clientLang, autoLangCode);
const tracks =
info.player_response.captions.playerCaptionsTracklistRenderer
.captionTracks;
if (tracks && tracks.length) {
let track = tracks.find(
(t) => t.languageCode === (clientLang || autoLangCode || "en")
);
if (track) {
const captionLink = `${track.baseUrl}&fmt=${
format !== "xml" ? format : ""
}`;
const xmlData = await new Promise((resolve, reject) => {
https
.get(captionLink, (response) => {
let data = "";
response.on("data", (chunk) => {
data += chunk;
});
response.on("end", () => {
resolve(data);
});
})
.on("error", (error) => {
reject(error);
});
});
const parser = new xml2js.Parser();
parser.parseString(xmlData, async (err, result) => {
if (err) {
console.error("Error parsing XML:", err);
} else {
const textContent = result.transcript.text.map(
(textElement) => textElement._
);
const processedText = textContent.join(" ");
// Send the response based on the selected file format
if (selectedFormat === "xml") {
res.status(200).send(xmlData);
} else if (selectedFormat === "txt") {
res.status(200).send(processedText);
} else {
res
.status(400)
.json({ error: "Invalid file format selected" });
}
}
});
} else {
res
.status(404)
.json({
error:
"Could not find captions for the specified language",
});
}
} else {
res
.status(404)
.json({ error: "No captions found for this video" });
}
} else {
console.error("No Info found for videoId:", videoId);
}
} catch (error) {
console.error("Error in download-caption process:", error);
res
.status(500)
.json({ error: "Internal Server Error", details: error.message });
}
Code is working fine on localhost , bt getting this error on my production server (vercel)
Please help me resolving this issue asap.
Same here, even with a minimal example like this:
const fs = require("fs");
const ytdl = require("ytdl-core");
ytdl("http://www.youtube.com/watch?v=aqz-KE-bpKQ").pipe(
fs.createWriteStream("video.mp4")
);
It creates an empty file. 🫤
same issue here... cant do anything with this new error now
and i use discord-ytdl-core as package