-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
This is a great project. Can you provide a tutorial to introduce the architecture design of this project? #51
Comments
I've never done one of those before (I'm still new to public open source projects, it's all very new to me lol) What exactly would the tutorial entail? |
haha sigh。。。 |
Ah! I apologize for my incredibly messy code lol, I need to make commenting a habit. It's actually not an optimization in Node.JS / Electron that made yt-dlp start very fast; it was actually a Python bridge I wrote for yt-dlp; the method I use is somewhat "hacky," but it definitely had a good turnout. Each time you execute the yt-dlp binary, it has to load all of the relevant Python libraries on each execution (which at least on Windows systems I've tested, made it drastically slower); I wanted to figure out another way to make that more optimized. The Python bridge's main purpose is to allow the executable to be ran once (and continue running until closed), and basically provide a "constantly running yt-dlp launcher" -- the goal of it was to load all of the libraries required by yt-dlp during startup, so every yt-dlp command can be executed instantly by that running process without slowing down your computer with loading all of the libraries needed each time a command was run. While it was in early development, I made a little comparison between using standard yt-dlp (left side, v1.0) and the Python bridge (right side, v2.0+) pythonws.1.mp4downloading_playlist.1.mp4The bridge also implements Python's threading system, so each command that is executed will spawn asynchronously while maintaining only one running process -- 12 downloads in the app would've spawned 12 different processes if it were using yt-dlp itself, whereas it keeps a single process using the bridge. |
thank you for helping me, you are so kind |
It could be faster, but I chose Python because yt-dlp is also written in Python - there is an entire Python API exposed by yt-dlp (and upstream) for developers to integrate, which also simplified the library loading. (and in my testing, even with 7 concurrent downloads, the bridge doesn't use many resources; Python seems to be working perfectly in terms of speed :D) |
ohh, very cooooool ... continuous attention |
I think it's best to submit your patch to yt-dlp repo, because if this get integrate into yt-dlp it's a win-win for us, so much improvement can be made from using this bridge honestly, mpv and other project that makes use of yt-dlp also benefit from it which is amazing! |
Not sure that's a goal for them; the bridge is functionally a wrapper for yt-dlp, and being as niche of a use case it is I'd think it's best to keep them separate. I don't intend to submit a patch myself, if I'm going to be honest. However, I don't mind submitting a patch with a similar function to this if a contributor of yt-dlp says it'd be a good addition beforehand, but again, I don't think it's one of their goals. |
We should try to discuss with @pukkandan, honestly in practice being able to run yt-dlp as system service is such a big deal because it eliminates slow startup time, and if we make use of requests/urllib3's ConnectionPool we gain even more speed, this is huge for media players with yt-dlp backend like mpv. |
yt-dlp is primarily a CLI tool, not a service/daemon and we provide a Python API for extendability. This project is basically a JRPC wrapper for a persistent yt-dlp and has a completely different user interface. It makes zero sense for this to part of yt-dlp itself. |
This is a great project. Can you provide a tutorial to introduce the architecture design of this project?
The text was updated successfully, but these errors were encountered: