0

As the title, I have checked the readme file of GitHub, and then I wrote the following code:

YoutubeDL ytdl = new YoutubeDL();
string ytdlp = fileDirectory + "\\yt-dlp.exe";
string ffmpeg = fileDirectory + "\\ffmpeg.exe";
ytdl.YoutubeDLPath = ytdlp;
ytdl.FFmpegPath = ffmpeg;
ytdl.OutputFolder = Path.Text;
var options = new OptionSet()
{
    Cookies = Cookies.Text,
};
//var res = await ytdl.RunWithOptions(new string[] { URL.Text }, options, CancellationToken.None);
var res2 = await ytdl.RunVideoDownload(URL.Text);
string path = res2.Data;
await Console.Out.WriteLineAsync(path);

Also, I hit a breakpoint in the "var res2 = await ytdl.RunVideoDownload(URL.Text);" statement, and I can see --cookies of options.

▶options{ --cookies "D:\Codes\CSharp\BDownloaderRe\BDownloaderRe\bin\Debug\net6.0-windows\cookie.txt"}YoutubeDLSharp.Options.OptionSet

screenshot of vs.

However, this video download does not follow my cookie options. As you know, some video websites require login to obtain high-definition videos, so how should I modify my code?

Grateful!

I've read the GitHub readme, and watched the definitions, finally got stuck, I went to chatgpt, and it finally gave me a wrong answer!

0 Answers0