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
Improve argument handling for aria2c #8332
Conversation
This is by design. Downloaders are suppose to be neutral, if you want to use your predefined config you should be able to use
This is also by design. This keeps it similar to other downloaders behavior, and pre-allocation options are better explored on a case by case basis. Removing the duplication would make sense though.
Agreed, but tying it to Maybe we can think of something better.
Contrary to what you are saying |
You are correct we can. It just I feel it's counterintuitive, because who could figure out to do that without reading yt-dlp source code and finding your comment? I guess you could argue that whoever uses a aria2.conf must be geeky enough to do that.
Fair enough. Consistency is important.
Please help. I know we can, again, ask users to pass those 3 arguments through |
It's not necessary to read the source code. |
What I meant is that without reading the code, a naive user would not easily notice that their aria2 config file is not applied, or how many concurrent downloads are used, all of which are very specific to this aria2c external downloader. The reasoning "Downloaders are suppose to be neutral, thus should not use user config" is fine, but it's no where to be found in yt-dlp's README. Many yt-dlp users are not developers. It's no easy task to deduce the downloader's "misbehavior". Of course, if somehow there is a section in the README that lists such design philosophies of the downloaders, and provide workarounds with detailed explanations, all would be good. Since there is not yet, I think maybe it's better to both utilizing existing yt-dlp options, and make better unconfigurable defaults. |
It would be very welcome if it could be created by you then |
Oh, I know I do not have the expertise on yt-dlp downloaders to do that. I don't even know how half the downloaders work (such as axel, httpie). And this is the first time I look at yt-dlp's source. I don't know why you guys design like this. |
I don't know or use them either, but it would be good to have you work on the |
I reverted most of the changes and only kept the remove-duplicate-argument part. It is bad because it's added AFTER Hope the PR is more agreeable now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only want to deal with the duplicate argument here this seems fine by me. We can track the README improvements in an issue if you feel like it should be addressed in the future
Sure. Let's do that in a separate issue and I'll try to improve it. |
Authored by: CrendKing
IMPORTANT: PRs without the template will be CLOSED
Description of your pull request and other information
Currently the argument handling of aria2c has several issues:
It uses
--no-conf
, thus ignoring user'saria2.conf
config file. There is no inherit reason yt-dlp requires this to work, because if an option is specified both in config file and in argument, the argument (which yt-dlp uses) takes priority.It forces
--file-allocation=none
, twice, while the aria2c offers subjectively better choices. I suggest we don't force if it's not necessary.It hard codes concurrent download segments/splits to 16, instead of respecting yt-dlp's own
--concurrent-fragments
. In the commit introducing these hardcodes, the author didn't mention any reason why he put in such numbers.Note that the current
--concurrent-fragments
default value is 1. Therefore, after this change, user might observe huge slowdown for site supporting multiple concurrent connections from single IP. It could also give user tool to fix cases when a site would ban IP that makes multi-connections.cmd += self._option('--max-overall-download-limit', 'ratelimit')
generates something like--max-overall-download-limit 1M
, while aria2c requires--max-overall-download-limit=1M
.Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?
Copilot Summary
🤖 Generated by Copilot at 94480ae
Summary
🛠️🚀🆕
Improved aria2c integration and option handling in
yt_dlp/downloader/external.py
. Added concurrency and segmentation options for aria2c and aseparator
argument for external downloaders.Walkthrough
_option
method ofExternalFD
class to acceptseparator
argument for different command option formats (link)_make_cmd
method ofAria2cFD
class by removing redundant, unnecessary, or conflicting options and adding options for concurrent downloads, connections, and segments (link, link, link)