Skip to content

Commit 656e411

Browse files
committed
Update to 1.3.5
1 parent e061e5d commit 656e411

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

README.md

+21-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848

4949
1. **[可跳过]** 使用 `mvn clean package` 命令进行编译。
5050

51-
2. 输入 `java -jar bili-download-1.3.2-jar-with-dependencies.jar`,进入程序。若您希望启用 debug 模式,请在参数中添加 `debug`
52-
,即输入 `java -jar bili-download-1.3.2-jar-with-dependencies.jar debug`,这将显示一些调试信息。
51+
2. 输入 `java -jar bili-download-1.3.5-jar-with-dependencies.jar`,进入程序。若您希望启用 debug 模式,请在参数中输入 `debug`
52+
,即输入 `java -jar bili-download-1.3.5-jar-with-dependencies.jar debug`,这将显示一些调试信息。若仅需从 URL 下载文件,请在参数中输入 `direct "<url>" "<path>"`,如输入 `java -jar bili-download-1.3.5-jar-with-dependencies.jar direct "http://upos-sz-mirrorkodo.bilivideo.com/upgcxcode/90/37/315703790/315703790-1-30336.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8gNEVE5XREto8z5JZC2X2gkX5L5F1eTX1jkXlsTXHeux_f2o859IB_&ua=tvproj&uipk=5&nbs=1&deadline=1622289611&gen=playurlv2&os=kodobv&oi=2078815810&trid=b7708dc7ef174e5bbe4fba32f5418517t&upsig=29cbb17759b52b6499638195bf0861aa&uparams=e,ua,uipk,nbs,deadline,gen,os,oi,trid&mid=474403243&bvc=vod&orderid=0,1&logo=80000000" "D:\BiliDownload\快住手!这根本不是 Kawaii Bass!_ 恋のうた Remix 工程演示.mp4"`,程序会在下载完成之后直接退出
5353

5454
3. 输入一个 AV 号或 BV 号。
5555

@@ -106,12 +106,30 @@
106106

107107
7. **[BUG]** 程序在进行多线程下载时会出现 `java.io.IOException: Server returned HTTP response code: 416 for URL: ...` 等错误。
108108

109-
8. 本程序仍然存在诸多问题,欢迎大家多多投递 issue 与 pull request。
109+
8. **[BUG]** 在第`n`次重试下载时,即使进度达到了100%也不会停止,而是待10s内平均速度为零后进行第`n+1`次重试,并且立即下载完毕。
110+
111+
9. **[BUG]** 在下载时,即使有数据正在传输,瞬时速度也为零。
112+
113+
10. 本程序仍然存在诸多问题,欢迎大家多多投递 issue 与 pull request。
110114

111115
---
112116

113117
# ChangeLog
114118

119+
## 1.3.5
120+
121+
### 1. 添加了下载重试功能
122+
123+
当10s内平均速度达到零时,程序会中断下载并重试。
124+
125+
### 2. 详细了速度信息
126+
127+
之前的 `速度` 更名为 `平均速度`;添加了 `瞬时速度`,指0.5s内的平均速度。
128+
129+
### 3. 添加了直接下载功能
130+
131+
直接在参数中输入 `direct "<url>" "<path>"` 即可下载指定 URL 中的文件。
132+
115133
## 1.3.2
116134

117135
### 解决了如图所示的问题

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>me.naptie</groupId>
88
<artifactId>bili-download</artifactId>
9-
<version>1.3.2</version>
9+
<version>1.3.5</version>
1010
<build>
1111
<plugins>
1212
<plugin>

src/main/java/me/naptie/bilidownload/Main.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ public class Main {
3030

3131
public static void main(String[] args) throws IOException, InterruptedException {
3232
beginTime = System.currentTimeMillis();
33-
debug = args.length > 0 && args[0].equalsIgnoreCase("debug");
3433
config = new File("config.yml");
34+
if (args.length > 2 && args[0].equalsIgnoreCase("direct")) {
35+
String url = args[1];
36+
String path = args[2];
37+
downloadFromUrl(url, path);
38+
System.out.println("\n程序运行结束;总运行时间:" + getFormattedTime(System.currentTimeMillis() - beginTime));
39+
System.exit(0);
40+
}
41+
debug = args.length > 0 && args[0].equalsIgnoreCase("debug");
3542
setScanner();
3643
String id = getNumber();
3744
String[] login = login();
@@ -41,6 +48,7 @@ public static void main(String[] args) throws IOException, InterruptedException
4148
String[] path = getPath((String) specified[1]);
4249
download(details, path);
4350
System.out.println("\n程序运行结束;总运行时间:" + getFormattedTime(System.currentTimeMillis() - beginTime));
51+
System.exit(0);
4452
}
4553

4654
private static void setScanner() throws FileNotFoundException {
@@ -254,6 +262,7 @@ private static Object[] getResolutions(JSONObject info, String[] auth, boolean t
254262
System.out.println("\n正在获取清晰度信息······");
255263
String videoUrlTV = "https://api.snm0516.aisee.tv/x/tv/ugc/playurl?avid=" + info.getIntValue("aid") + "&mobi_app=android_tv_yst&fnval=80&qn=120&cid=" + cid + (tv ? "&access_key=" + auth[1] : "") + "&fourk=1&platform=android&device=android&build=103800&fnver=0";
256264
String videoUrlWeb = "https://api.bilibili.com/x/player/playurl?avid=" + info.getIntValue("aid") + "&cid=" + cid + "&fnval=80&fourk=1";
265+
// String videoUrlWebPGC = "https://api.bilibili.com/pgc/player/web/playurl?cid=" + cid + "&qn=120&fourk=1&fnver=0&fnval=80";
257266
JSONObject videoTV = HttpManager.readJsonFromUrl(videoUrlTV, "#", true);
258267
JSONObject videoWeb = HttpManager.readJsonFromUrl(videoUrlWeb, auth[0], false).getJSONObject("data");
259268
JSONArray qualitiesTV = videoTV.getJSONArray("accept_description");
@@ -579,7 +588,7 @@ private static long downloadFromUrl(String address, String path, List<Map.Entry<
579588
long remainingSizeLen = calcRemainingSize(status);
580589
int threadAmount = status.size();
581590
double remainingSize = remainingSizeLen / 1024.0 / 1024.0;
582-
System.out.println("剩余文件大小:" + String.format("%,.3f", remainingSize) + (debug ? "MB(" + remainingSizeLen + "B)" : "MB"));
591+
System.out.println("\n剩余文件大小:" + String.format("%,.3f", remainingSize) + (debug ? "MB(" + remainingSizeLen + "B)" : "MB"));
583592
System.out.println("下载所用线程数:" + threadAmount);
584593
System.out.println("本次是第" + tries + "次重试,若数次下载失败请考虑强制退出程序");
585594
long beginTime = System.currentTimeMillis();

0 commit comments

Comments
 (0)