网上很少有的教程ajax调用。
- aria2作为后台下载服务器,接受前台(浏览器或者cmd命令端口)的命令进行下载。
- 有了以下ajax命令就可以在网页上点击按钮直接调用aria2后台下载了。
aria2提供网页UI控制界面如Aira2Ng等,直接提供下载地址,提供相关控制下载。
我是对照的http://aria2c.com/以及Aira2Ng请求参数慢慢推敲的,大家也可以这么来获取更多命令。
像什么nodejs已经python也都可以调用,但未深入研究。只觉得ajax调用比较亲民实用,故此研究。并分享出来。
自定义工具下载下载地址
postMan能通过也就等于ajax可以使用了,原理一致。需要有前端知识。
- cmd启动命令可以看日志,窗口关闭失效,
aria2c.exe –conf-path=aria2.conf
- postman请求参数设置
- 请求地址http://localhost:6800/jsonrpc
- 请求参数如下:(注意post 参数在 body 下 raw下面)
{“lowest-speed-limit”:”1″} 1表示一字节
返回结果
{ “jsonrpc”: “2.0”, “method”: “aria2.addUri”, “id”: “QXJpYU5nXzE1NzA3MDg5MjZfMC45ODgyODc0NDcxMTE2MzI3”, “params”: [[“http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”, “http://fastsoft.onlinedown.net/down/PCQQ9.1.8.26211.exe”], { “allow-overwrite”: “false”, “allow-piece-length-change”: “false”, “always-resume”: “true”, “async-dns”: “true”, “auto-file-renaming”: “true”, “bt-enable-hook-after-hash-check”: “true”, “bt-enable-lpd”: “false”, “bt-force-encryption”: “false”, “bt-hash-check-seed”: “true”, “bt-load-saved-metadata”: “false”, “bt-max-peers”: “55”, “bt-metadata-only”: “false”, “bt-min-crypto-level”: “plain”, “bt-remove-unselected-file”: “false”, “bt-request-peer-speed-limit”: “51200”, “bt-require-crypto”: “false”, “bt-save-metadata”: “true”, “bt-seed-unverified”: “true”, “bt-stop-timeout”: “0”, “bt-tracker-connect-timeout”: “60”, “bt-tracker-interval”: “0”, “bt-tracker-timeout”: “60”, “check-integrity”: “false”, “conditional-get”: “false”, “connect-timeout”: “60”, “content-disposition-default-utf8”: “false”, “continue”: “true”, “dir”: “./QQ下载文件夹2”, “dry-run”: “false”, “enable-http-keep-alive”: “true”, “enable-http-pipelining”: “false”, “enable-mmap”: “false”, “enable-peer-exchange”: “false”, “file-allocation”: “falloc”, “follow-metalink”: “true”, “follow-torrent”: “true”, “force-save”: “false”, “ftp-pasv”: “true”, “ftp-reuse-connection”: “true”, “ftp-type”: “binary”, “hash-check-only”: “false”, “http-accept-gzip”: “false”, “http-auth-challenge”: “false”, “http-no-cache”: “false”, “lowest-speed-limit”: “0”, “max-connection-per-server”: “5”, “max-download-limit”: “0”, “max-file-not-found”: “0”, “max-mmap-limit”: “9223372036854775807”, “max-resume-failure-tries”: “0”, “max-tries”: “5”, “max-upload-limit”: “0”, “metalink-enable-unique-protocol”: “true”, “metalink-preferred-protocol”: “none”, “min-split-size”: “10485760”, “no-file-allocation-limit”: “5242880”, “no-netrc”: “false”, “out”: “QQ66.exe”, “parameterized-uri”: “false”, “pause-metadata”: “false”, “piece-length”: “1048576”, “proxy-method”: “get”, “realtime-chunk-checksum”: “true”, “remote-time”: “false”, “remove-control-file”: “false”, “retry-wait”: “0”, “reuse-uri”: “true”, “rpc-save-upload-metadata”: “true”, “save-not-found”: “true”, “seed-ratio”: “0”, “split”: “5”, “stream-piece-selector”: “default”, “timeout”: “60”, “uri-selector”: “feedback”, “use-head”: “false”, “user-agent”: “Transmission/2.77” }] }
页面调用
Aria2 & YAAW 使用说明
下载工具系列——Aria2 (几乎全能的下载神器)
评论
评论关闭