ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.19k stars 10.02k forks source link

Use JSON-RPC interface to download the video through aria2 #5822

Open wanglongqi opened 9 years ago

wanglongqi commented 9 years ago

Currently, download through aria2 is implemented in external downloader. I do not like the interface in the terminal, and aria2 has a pretty good JSON-RPC interface, which can be managed from web interface. I would like to be able to see the download list and speed through web browser instead of terminal window, since they are easier to read and looks prettier.

jaimeMF commented 9 years ago

If the flag --enable-rpc is all you need to enable JSON-RPC, does adding it you youtube-dl with the --external-downloader-args option work? If not, could you post the command you would use from the command line to make aria2c use the JSON-RPC

wanglongqi commented 9 years ago

Maybe I do not use aria2 the right way. I have a JSON-RPC server running on my computer, rerun aria2c with --enable-rpc will print error like IPv4 RPC: failed to bind TCP port 6800.

jaimeMF commented 9 years ago

Ok, so we should conect to the server and execute the JSON-RPC commands?

wanglongqi commented 9 years ago

Yes, I think it should be not hard to implement. Here is an example from document:

>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> opts = dict(dir='/tmp',
...             header=['Accept-Language: ja',
...                     'Accept-Charset: utf-8'])
>>> s.aria2.addUri(['http://example.org/file'], opts)
'1'

The main problem is how to assemble this function into current framework. Maybe add another external downloader or read configuration file.

xfoxfu commented 8 years ago

:+1:

Such features is quite useful when using tools like Aria2GUI.

ArtemProkopenko commented 8 years ago

+ Very useful feature.

zoenglinghou commented 5 years ago

Is there any update on the feature? Thanks ❤

ghost commented 4 years ago

aria2p is a client that sends the RPC commands to an aria2 server. We could try to symlink aria2 to aria2p in order to fool youtube-dl into using aria2p instead. Where is the aria2 executable used by youtube-dl located?

pawamoy commented 4 years ago

@frogger72 maybe you could add a new external downloader using aria2p instead of aria2c? https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/downloader/external.py#L181

P0oOOOo0YA commented 2 years ago

Why youtube-dl doesn't provide its own JSON-RPC interface? Much better than passing command line args to the script.