Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YoutubeDL version value is not cross-platform compatible #61

Open
kitsumed opened this issue Dec 23, 2024 · 0 comments
Open

YoutubeDL version value is not cross-platform compatible #61

kitsumed opened this issue Dec 23, 2024 · 0 comments

Comments

@kitsumed
Copy link

kitsumed commented Dec 23, 2024

The version key in the YoutubeDL class is not working as expected on Linux systems due to its use of FileVersionInfo.GetVersionInfo, which can have undesired behavior, like returning a empty string. A stable work-around would be to get the version output from the yt-dlp binary itself by running it with the --version argument when first creating the object and then save the value to a private version key that can later be read using the public version key as a GET; only.

As a workaround for others users, you can get the current yt-dlp version using this code (not async)

// Create a temporary yt-dlp proc
YoutubeDLProcess temporaryYTDLPProc = new YoutubeDLProcess("yt-dlp path here");
// Create a event handler to listen to the proc outputs
EventHandler<DataReceivedEventArgs> outputHandler = (o, e) =>
{
// e.Data is the proc output, when running --version arg, the first and only output should be in yyyy.MM.dd format.
};
// Attach the event handler to the proc
temporaryYTDLPProc.OutputReceived += outputHandler;
// Run the proc with the --version argument and wait for proc exit
temporaryYTDLPProc.RunAsync(null, new OptionSet { Version = true}).Wait();
// Detach the event handler to allow the GC to free memory
temporaryYTDLPProc.OutputReceived -= outputHandler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant