Created
October 19, 2023 02:31
-
-
Save image72/ec7a0b546bf27b895cc8f46d8956331b to your computer and use it in GitHub Desktop.
aria2 downloads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const link = window.prompt("Enter URL"); | |
fetch("http://127.0.0.1:6800/jsonrpc", { | |
method: "POST", | |
headers: { | |
"content-type": "application/x-www-form-urlencoded" | |
}, | |
body: JSON.stringify({ | |
jsonrpc: "2.0", | |
id: "someID", | |
method: "aria2.addUri", | |
params: [ | |
"token:TOKEN_STRING", | |
[link], | |
{ out: link.split("/").pop() } | |
] | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dl2() { | |
link=$1 | |
# get params[0].out filename by link | |
filename=$(basename -- "$link") | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
out_filename="$filename.out.$extension" | |
curl -X POST -H "Content-Type: application/json" -d '{ | |
"jsonrpc": "2.0", | |
"id": "someID", | |
"method": "aria2.addUri", | |
"params": [ | |
"token:TOKEN_STRING", | |
["'$link'"], | |
{ "out": "'$out_filename'" } | |
] | |
}' http://127.0.0.1:6800/jsonrpc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment