简体   繁体   中英

Can aria2c download list of urls with specific file names for each?

For example i have a list of URLs:

https://link.com/file/get/somefile.ext
https://go.com/download/anotherfile.ext
https://program.com/selection/download.php?id=26162

I want to set a specific name for last URL, something like this:

https://program.com/selection/download.php?id=26162 -o thirdfile.ext

Is it possible with aria2c download list syntax?

I know that I can do like this:

aria2c https://link.com/file/get/somefile.ext
aria2c https://go.com/download/anotherfile.ext
aria2c https://program.com/selection/download.php?id=26162 -o thirdfile.ext

But this way I run just too much of aria2c's. ._.

From the documentation on --input-file=

Additionally, options can be specified after each URI line. Option lines must start with one or more white space characters ( SPACE or TAB ) and must only contain one option per line. … See the Input File subsection for details.

If you ask me, that is not exactly crystal clear. So here's an example of an input file (with a single entry):

http://www.openclonk.org/header/logo.png
        out=openclonk.png

Example:

make a textfile, list.txt , with links:

https://www.google.hu/search?q=a&start=0
https://www.google.hu/search?q=a&start=10
https://www.google.hu/search?q=a&start=20

command:

aria2c -ilist.txt -j2

where -j option specifies the number of parallel downloads.

Result:

    D:\aria2c>aria2c -ihtml.txt

12/22 07:49:57 [NOTICE] Downloading 3 item(s)

12/22 07:49:57 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)

12/22 07:49:57 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)

12/22 07:49:57 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)

12/22 07:49:57 [NOTICE] File already exists. Renamed to /cygdrive/d/aria2c/search.1.

12/22 07:49:57 [NOTICE] File already exists. Renamed to /cygdrive/d/aria2c/search.2.

12/22 07:49:58 [NOTICE] Download complete: /cygdrive/d/aria2c/search.2

12/22 07:49:58 [NOTICE] Download complete: /cygdrive/d/aria2c/search.1
[#c86c02 0B/0B CN:1 DL:77KiB]
12/22 07:49:58 [NOTICE] Download complete: /cygdrive/d/aria2c/search

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
efcadb|OK  |    46KiB/s|/cygdrive/d/aria2c/search.2
554614|OK  |    44KiB/s|/cygdrive/d/aria2c/search.1
c86c02|OK  |    60KiB/s|/cygdrive/d/aria2c/search

Status Legend:
(OK):download completed.

In the result, search will be the start=0 file and te search.2 will be the start=20 file, in order. So you can rename them in order, with an another script.

Solution:

Make a textfile, list.txt , with links, and after each link, started with tab or space the option:

https://www.google.hu/search?q=a&start=0
 out=s1.html
https://www.google.hu/search?q=a&start=10
 out=s2.html
https://www.google.hu/search?q=a&start=20
 out=s3.html

Command:

aria2c --input-file list.txt

Result:

D:\aria2c>aria2c --input-file list.txt

12/22 20:54:44 [NOTICE] Downloading 3 item(s)

12/22 20:54:45 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)

12/22 20:54:45 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)

12/22 20:54:45 [WARN] aria2c had to connect to the other side using an unknown TLS protocol. The integrity and confidentiality of the connection might be compromised.
Peer: www.google.hu (2a00:1450:400d:805::2003:443)
[DL:37KiB][#177d35 0B/0B][#bae5ee 0B/0B][#d1da5b 0B/0B]
12/22 20:54:46 [NOTICE] Download complete: /cygdrive/d/aria2c/s1.html
[DL:53KiB][#bae5ee 0B/0B][#d1da5b 0B/0B]
12/22 20:54:47 [NOTICE] Download complete: /cygdrive/d/aria2c/s2.html

12/22 20:54:47 [NOTICE] Download complete: /cygdrive/d/aria2c/s3.html

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
177d35|OK  |    53KiB/s|/cygdrive/d/aria2c/s1.html
bae5ee|OK  |    18KiB/s|/cygdrive/d/aria2c/s2.html
d1da5b|OK  |    15KiB/s|/cygdrive/d/aria2c/s3.html

Status Legend:
(OK):download completed.

aria2c examples

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM