PatreonDownloader icon indicating copy to clipboard operation
PatreonDownloader copied to clipboard

[Idea] Use `youtube-dl` for external videos

Open M-rcus opened this issue 4 years ago • 8 comments

First of all, thanks for this great project. It's working perfectly for downloading a lot of attachments (without having to go through each attachment on every post manually).

I'm not sure how feasibly it is, so it's mainly just an idea/suggestion, but some of the sites listed under "Known not implemented or not tested features" are supported by a tool called youtube-dl.

While I don't really have a clue on the most ideal way to implement youtube-dl, it might be worth looking into.

Thanks again for the great tool. Looking forward to further improvements :)

M-rcus avatar Jan 09 '20 22:01 M-rcus

First of all, thank you! I'm really glad that this application is useful for other people.

I do have plans on making plugins utilizing youtube-dl and, possibly gallery-dl to download some of the external urls supported by those applications.

Unfortunately I can't say for sure when this will be implemented but most features listed in "Known not implemented or not tested features" are treated by me as base features of PatreonDownloader and should be implemented before I can call it feature-complete.

AlexCSDev avatar Jan 10 '20 15:01 AlexCSDev

Would this plugin merely call the external executable? or execute the python version?

flagmaggot avatar Mar 09 '21 19:03 flagmaggot

The usage of standalone external executable is preferred.

AlexCSDev avatar Mar 09 '21 21:03 AlexCSDev

Ok perfect, I took a look at the code and what you explained in the other issue and I know what can be done to utilize youtube-dl. Unsure how to allow for compatibility between windows and linux however (I can certainly do it for windows)

flagmaggot avatar Mar 11 '21 02:03 flagmaggot

Cross-platform compatibility is actually quite easy.

bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var process = new Process
{
    StartInfo =
    {
        FileName = $"executable{(isWindows ? ".exe" : "")}",
        Arguments = "arguments here",
        UseShellExecute = false,
        CreateNoWindow = false,
        RedirectStandardOutput = true
    }
};
process.Start();

// Make sure app has finished the work
process.WaitForExit();

AlexCSDev avatar Mar 13 '21 00:03 AlexCSDev

I did get it working as a plugin but I found it to stop downloading a video for some reason and gave up as I had no way to know why youtube-dl "paused." I got frustrated and just wrote out all the YouTube links into a text file that I could then feed into youtube-dl using -a

I can share the plugin code, maybe it will work for someone else but it was dreadfully easy to implement just wasn't sure about reliability as there is no output to the console (maybe redirect standard output flag would help?)

flagmaggot avatar Mar 13 '21 00:03 flagmaggot

I can share the plugin code, maybe it will work for someone else but it was dreadfully easy to implement just wasn't sure about reliability as there is no output to the console (maybe redirect standard output flag would help?)

Well, I'll leave this decision up to you. I might take a look at it at some point, but I really don't have much free time lately.

AlexCSDev avatar Mar 13 '21 00:03 AlexCSDev

#142 fixes this issue. Now the youtube videos are automatically downloaded. I tested it, and it works like a charm :tada:

1zizi1 avatar Oct 03 '22 01:10 1zizi1