I'm not sure whether it's failing to download, or just the location is set incorrectly.
Environment: VSCode
Windows 11
Bash Shell
async function downloadYoutubeToFolder({ episode, url, title }) {
const pathToDL = "D:/path/to/directory/";
// Check if the directory exists
if (!fs.existsSync(pathToDL)) {
// If it doesn't exist, create the directory
fs.mkdirSync(pathToDL);
}
const outputFilePath = `${pathToDL}/${title}.json`;
const outputFilePathVid = `${pathToDL}/${title}`;
const YT_OPTS = {
dumpSingleJson: true,
noCheckCertificates: true,
preferFreeFormats: true,
addHeader: ["referer:youtube.com", "user-agent:googlebot"],
path: outputFilePathVid,
output: title,
writeInfoJson: true,
};
try {
const promise = youtubeDl(url, YT_OPTS).then((output) =>
fs.writeFileSync(outputFilePath, JSON.stringify(output, null, 2))
);
const result = await logger(promise, title);
} catch (err) {
console.log("error", err);
}
//console.log(result);
}
The result is here:
With the following in the output in the JSON section under filename
"_filename": "D:\\path\\to\\video", "filename": "D:\\path\\to\\video", "__write_download_archive": false
Attached is the JSON output. I'm really confused as to where it's downloading, or if it's failing to download, how to get it to download in a chosen directory.
JSONOutput.json
Hello, this library is a simple connector for https://github.com/yt-dlp/yt-dlp. I can't help there, try to use yt-dlp via CL and then do the same using this library.
I'm not sure whether it's failing to download, or just the location is set incorrectly.
Environment: VSCode Windows 11 Bash Shell
The result is here:
With the following in the output in the JSON section under filename
"_filename": "D:\\path\\to\\video", "filename": "D:\\path\\to\\video", "__write_download_archive": false
Attached is the JSON output. I'm really confused as to where it's downloading, or if it's failing to download, how to get it to download in a chosen directory. JSONOutput.json