1 | # aria2
|
2 |
|
3 | aria2 是一個強大的下載工具,`dmhy-subscribe` 靠他來下載並管理 magnet
|
4 |
|
5 | * [安裝方法](#安裝方法)
|
6 | * [設置 aria2.conf](#設置-aria2conf)
|
7 | * [開啟 daemon](#開啟-daemon)
|
8 | * [使用範例](#使用範例)
|
9 | * [使用 UI 介面](#使用-UI-介面)
|
10 | * [瀏覽器插件](#瀏覽器插件)
|
11 | * [使用 webui-aria2 (手動)](#使用-webui-aria2-手動)
|
12 | * [使用 AriaNg (手動)](#使用-AriaNg-手動)
|
13 | * [AriaNg 調整語言](#AriaNg-調整語言)
|
14 |
|
15 | ## 安裝方法
|
16 |
|
17 | 下載點:
|
18 |
|
19 | * Ubuntu: `sudo apt-get install aria2` 或自行編譯
|
20 | * Windows 10: 從 [GitHub](https://github.com/aria2/aria2/releases/latest) 下載 zip 將 aria2c.exe 解壓到適當的位置 (推薦 `D:\aria2\aria2c.exe`)
|
21 |
|
22 | ## 設置 aria2.conf
|
23 |
|
24 | <details open>
|
25 | <summary>aria2.conf</summary>
|
26 | <p>
|
27 |
|
28 | ```ini
|
29 | # 開啟 daemon 模式
|
30 | enable-rpc=true
|
31 | rpc-allow-origin-all=true
|
32 | rpc-listen-all=true
|
33 | rpc-listen-port=6800
|
34 |
|
35 | # 這邊請自行設置密碼,這邊以 helloworld 為例
|
36 | rpc-secret=helloworld
|
37 | ```
|
38 |
|
39 | </p>
|
40 |
|
41 | </details>
|
42 |
|
43 | * Ubuntu: aria2 預設會去找 `~/.aria2/aria2.conf` 或之後指定
|
44 | * Windows 10: 複製並存到適當位置 (推薦 `D:\aria2\aria2.conf`) 方便之後指定
|
45 |
|
46 | ## 開啟 daemon
|
47 |
|
48 | * Ubuntu:
|
49 |
|
50 | ```bash
|
51 | $ nohup aria2c & # ~/.aria2/aria2.conf
|
52 | # 或
|
53 | $ nohup aria2c -conf-path="aria2.conf的路徑" &
|
54 | ```
|
55 |
|
56 | * Windows 10: 將下面程式碼存成 `daemonize.vbs` 並雙擊執行,注意路徑
|
57 | <details open>
|
58 | <summary>daemonize.vbs</summary>
|
59 | <p>
|
60 |
|
61 | ```vbs
|
62 | ' https://gist.github.com/aa65535/5e956c4eb4f451ddec29
|
63 |
|
64 | CreateObject("Wscript.Shell").Run "D:\aria2\aria2c.exe --conf-path=D:\aria2\aria2.conf -D", 0
|
65 | ```
|
66 |
|
67 | </p>
|
68 | </details>
|
69 |
|
70 | 如果要關閉 deamon 請直接 `kill $(pidof aria2c)` 或是到工作管理員終止 `aria2c.exe`
|
71 |
|
72 | ## 使用範例
|
73 |
|
74 | 目前如果要用 `aria2` 來下載的話需要指定下載器及 jsonrpc
|
75 |
|
76 | ```bash
|
77 | $ dmhy cfg downloader aria2
|
78 | $ dmhy cfg aria2-jsonrpc "http://token:helloworld@localhost:6800/jsonrpc"
|
79 | # helloworld 要改成前面設定的密碼
|
80 | ```
|
81 |
|
82 | ```bash
|
83 | $ dmhy add "搖曳露營,DHR,720,繁體,Yuru"
|
84 | # 假設搖曳露營的訂閱識別碼為 ALR
|
85 | $ dmhy #下載全部
|
86 | $ dmhy dl ALR-08 #下載單集
|
87 | ```
|
88 |
|
89 | ## 使用 UI 介面
|
90 |
|
91 | aria2 常用的 ui 介面有 `webui-aria2` 和 `AriaNg`,不過安裝稍微有點麻煩,不是很熟悉的建議直接使用瀏覽器插件
|
92 |
|
93 | ### 瀏覽器插件
|
94 |
|
95 | 使用 Chrome 的建議安裝 [YAAW2 for Chrome](https://chrome.google.com/webstore/detail/yaaw2-for-chrome/mpkodccbngfoacfalldjimigbofkhgjn),裡面內建了 `webui-aria2` 和 `AriaNg`,還能直接從右鍵選單觸發下載
|
96 |
|
97 | 使用 Firefox 的可以用 [Aria2 下載器整合元件](https://addons.mozilla.org/zh-TW/firefox/addon/aria2-integration/),不過這只有支援 `AriaNg` 而已
|
98 |
|
99 | ### 使用 webui-aria2 (手動)
|
100 |
|
101 | 下載 [zip](https://github.com/ziahamza/webui-aria2/archive/master.zip) 並解壓縮到一個資料夾 (Windows 10 推薦解壓縮到 `D:\aria2\webui-aria2`)
|
102 |
|
103 | 先設置 configuration.js 將第 12 行的
|
104 |
|
105 | ```js
|
106 | // token: '$YOUR_SECRET_TOKEN$'
|
107 | ```
|
108 |
|
109 | 改成剛剛設定的密碼 (以上面 `helloworld` 為例) 並移除註解 (`//`)
|
110 |
|
111 | ```js
|
112 | token: 'helloworld'
|
113 | ```
|
114 |
|
115 | 然後直接點開 `index.html` 沒有跳錯誤就成功了
|
116 |
|
117 | ### 使用 AriaNg (手動)
|
118 |
|
119 | 到 [AriaNg Releases](https://github.com/mayswind/AriaNg/releases) 頁面選擇最新版的下載
|
120 |
|
121 | 解壓縮到任何資料夾,例如 `AriaNg`。
|
122 |
|
123 | 接下來直接點開裡面的 `index.html`,應該會發現連線失敗,先不用管。找到左側的 `AriaNg Settings`,在上方的選單點 `RPC(localhost:6800)`。
|
124 |
|
125 | 然後在下方的 `Alias` 填入自己認得的名稱,以及 `Aria2 RPC Secret Token` 填入上面設定的密碼(rpc-secret 的值)。完成後重新整理頁面應該就能使用了。
|
126 |
|
127 | #### AriaNg 調整語言
|
128 |
|
129 | 根據 [README.md 裡的 Usage Notes](https://github.com/mayswind/AriaNg#usage-notes),他說了因為語言檔是用非同步加載的方式載入的,所以需要用一個伺服器來提供檔案。
|
130 |
|
131 | 其中一種方法可以用 [httpsrv](https://github.com/maple3142/httpsrv) 來快速開啟一個伺服器。
|
132 |
|
133 | ```bash
|
134 | $ npm i -g httpsrv
|
135 | $ cd AriaNg # AriaNg 所在的資料夾
|
136 | $ httpsrv -i .
|
137 | # 到瀏覽器打開 localhost:3333 就好了
|
138 | ```
|
139 |
|
140 | 或是使用其他能做到一樣的事的伺服器也行(ex: python php nginx...)
|