Closed arcovoltaico closed 1 month ago
solved by using "github:XM4ZE/ytdl-core" }
yep same issue .
The error seems to start in video.getInfo function. when ytdl tries to access relatedVideoData etc
Same issue. But on windows is working fine, with same IP and everything
Try using this. Video in buffer results
let ytdl = require("ytdl-core")
let fs = require("fs")
async function ytdlcore(url) {
try {
const agent = ytdl.createAgent(JSON.parse(fs.readFileSync("cookies.json")));
const {
videoDetails
} = await ytdl.getInfo(url, {
lang: "id",
agent
});
const stream = ytdl(url, {
filter: 'videoandaudio',
agent
});
const chunks = [];
stream.on("data", (chunk) => {
chunks.push(chunk);
});
await new Promise((resolve, reject) => {
stream.on("end", resolve);
stream.on("error", reject);
});
const buffer = Buffer.concat(chunks);
return {
meta: {
title: videoDetails.title,
channel: videoDetails.author.name,
seconds: videoDetails.lengthSeconds,
description: videoDetails.description,
image: videoDetails.thumbnails.slice(-1)[0].url,
resolusi: videoDetails.embed,
},
buffer: buffer,
size: buffer.length,
};
} catch (error) {
throw error;
}
}
return await ytdlcore("https://youtu.be/pvlDjh_UgvA")
Is the cookie designation still valid? In my case, it works locally, but when deployed to a server, it is no longer available, so I created my own fork to support various methods other than cookies. https://github.com/ybd-project-ver1/ytdl-core
Describe the bug
My code has been working for months, but since recently, no YouTube video has been downloaded, and I am not even getting any error. I see that the file is created but remains 0 bytes. This has started happening recently in my 2 well-tested different systems, without changing any code, no matter what video you try.
I have tried this fix https://github.com/XM4ZE/ytdl-core , but it's not helping.
My code runs in the main.js Electron.
ytdl.getInfo(url).then((info: videoInfo) => { const formats = ytdl.filterFormats(info.formats, 'audioandvideo'); if (formats.length < 1) { notifyYoutubeDownloadError(id); }
I have tried also the suggested code with the same result : const ytdl = require('@distube/ytdl-core');
Environment