Skip to content

Commit 3fe39bc

Browse files
committed
Update to 1.3.6
1 parent 98baa3e commit 3fe39bc

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848

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

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
51+
2. 输入 `java -jar bili-download-1.3.6-jar-with-dependencies.jar`,进入程序。若您希望启用 debug 模式,请在参数中输入 `debug`
52+
,即输入 `java -jar bili-download-1.3.6-jar-with-dependencies.jar debug`,这将显示一些调试信息。若仅需从 URL
5353
下载文件,请在参数中输入 `direct "<url>" "<path>"`
5454
,如输入:
5555
```
56-
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"
56+
java -jar bili-download-1.3.6-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"
5757
```
5858
程序会在下载完成之后直接退出。
5959

@@ -116,12 +116,24 @@
116116

117117
9. **[BUG]** 在调用 FFmpeg 合并时,文件大小达到一定值(4GB左右)将不再写入。
118118

119-
10. 本程序仍然存在诸多问题,欢迎大家多多投递 issue 与 pull request。
119+
10. **[BUG]** 获取无水印源时有时会失败。
120+
121+
11. 本程序仍然存在诸多问题,欢迎大家多多投递 issue 与 pull request。
120122

121123
---
122124

123125
# ChangeLog
124126

127+
## 1.3.6
128+
129+
### 1. 添加了路径开头“~”的解析功能
130+
131+
当路径以“~”开头时,会自动将其替换为用户主目录。
132+
133+
### 2. 解决了 Linux / MacOS 上 FFmpeg 可执行文件的名称问题
134+
135+
在 Linux / MacOS 等平台上,可执行文件名一般不含 `.exe`
136+
125137
## 1.3.5
126138

127139
### 1. 添加了下载重试功能

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.5</version>
9+
<version>1.3.6</version>
1010
<build>
1111
<plugins>
1212
<plugin>

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

+14-5
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,15 @@ private static String[] getPath(String name) throws IOException {
326326
while (!pathSuccess) {
327327
if (hint) System.out.println("\n请输入保存路径:");
328328
savePath = input();
329-
File file = new File(savePath);
329+
File file;
330+
if (savePath.startsWith("~")) {
331+
String userHomeDir = Paths.get(System.getProperty("user.home")).toAbsolutePath().toString();
332+
if (debug) System.out.println("检测到路径以“~”开头,已找到用户主目录:" + userHomeDir);
333+
file = new File(userHomeDir, savePath.substring(1));
334+
savePath = file.getAbsolutePath();
335+
} else {
336+
file = new File(savePath);
337+
}
330338
if (!file.exists()) {
331339
if (hint) System.out.println("该目录不存在,请决定是否创建该目录(输入“Y”代表是,输入“N”代表否):");
332340
if (input().equalsIgnoreCase("Y")) {
@@ -386,14 +394,15 @@ private static void download(Object[] details, String[] path) throws IOException
386394
}
387395
}
388396
while (ffmpegSuccess == 0) {
389-
if (hint) System.out.println("\n请输入 ffmpeg.exe 目录(跳过合并请填“#”):");
397+
398+
if (hint) System.out.println("\n请输入 ffmpeg(.exe) 的绝对路径(跳过合并请填“#”):");
390399
String ffmpegPath = input();
391400
if (ffmpegPath.equals("#")) {
392401
ffmpegSuccess = -1;
393402
break;
394403
}
395-
ffmpeg = ffmpegPath.endsWith("ffmpeg.exe") ? new File(ffmpegPath) : new File(ffmpegPath, "ffmpeg.exe");
396-
ffmpegSuccess = ffmpeg.exists() ? 1 : 0;
404+
ffmpeg = (ffmpegPath.endsWith("ffmpeg.exe") || (!System.getProperty("os.name").toLowerCase().contains("windows") && ffmpegPath.endsWith("ffmpeg"))) ? new File(ffmpegPath) : new File(ffmpegPath, System.getProperty("os.name").toLowerCase().contains("windows") ? "ffmpeg.exe" : "ffmpeg");
405+
ffmpegSuccess = ffmpeg.exists() && !ffmpeg.isDirectory() ? 1 : 0;
397406
if (ffmpegSuccess == 1) {
398407
if (hint) System.out.println("请决定是否保存 FFmpeg 路径(输入“Y”代表是,输入“N”代表否):");
399408
if (input().equalsIgnoreCase("Y")) {
@@ -408,7 +417,7 @@ private static void download(Object[] details, String[] path) throws IOException
408417
}
409418
}
410419
if (ffmpegSuccess == 0) {
411-
System.out.println("该目录不存在 ffmpeg.exe");
420+
System.out.println("无法找到 ffmpeg(.exe)");
412421
}
413422
}
414423
boolean videoSuccess, audioSuccess;

src/main/java/me/naptie/bilidownload/utils/HttpManager.java

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public static HttpURLConnection readUrl(String url, String cookie, String userAg
3434
request.setRequestMethod("POST");
3535
}
3636
request.connect();
37+
if (request.getResponseCode() != 200) {
38+
throw new IOException("服务器返回状态码 " + request.getResponseCode());
39+
}
3740
return request;
3841
}
3942

0 commit comments

Comments
 (0)