Skip to content

Commit

Permalink
Merge pull request #236 from nICEnnnnnnnLee/dev
Browse files Browse the repository at this point in the history
V6.37 Update
  • Loading branch information
nICEnnnnnnnLee authored Nov 24, 2024
2 parents 1a483cb + 7d84c9f commit 34bd3a7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
8 changes: 3 additions & 5 deletions .github/release.info
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
* 修复:更新合辑视频链接的解析 #225
* 修复:纠正互动视频`graph_version`的获取方式
* 新增:一键下载:支持以标题/小标题是否匹配正则表达式为条件 #229
* 新增:仅下载音频时,允许自定义ffmpeg音频转换命令、自定义音频后缀格式(可能需要ffmpeg支持) #226,#227
* 其它详见[V6.35...V6.36](https://github.com/nICEnnnnnnnLee/BilibiliDown/compare/V6.35...V6.36)
* 修复:纠正一键下载时,以日期作为条件判断不准确的错误 #235
* 修复:更新字幕api的解析 #232
* 其它详见[V6.36...V6.37](https://github.com/nICEnnnnnnnLee/BilibiliDown/compare/V6.36...V6.37)
<hr/>

如果你是Win64用户,且没有java环境,请下载附件`*.win_x64_jre11.release.zip`或 `*.win_x64.msi`
10 changes: 7 additions & 3 deletions UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
## UPDATE
* V6.36
* V6.37 `2024-11-24`
* 修复:纠正一键下载时,以日期作为条件判断不准确的错误 #235
* 修复:更新字幕api的解析 #232
* 其它详见[V6.36...V6.37](https://github.com/nICEnnnnnnnLee/BilibiliDown/compare/V6.36...V6.37)
* V6.36 `2024-10-27`
* 修复:更新合辑视频链接的解析 #225
* 修复:纠正互动视频`graph_version`的获取方式
* 新增:一键下载:支持以标题/小标题是否匹配正则表达式为条件 #229
* 新增:仅下载音频时,允许自定义ffmpeg音频转换命令、自定义音频后缀格式(可能需要ffmpeg支持) #226,#227
* 其它详见[V6.35...V6.36](https://github.com/nICEnnnnnnnLee/BilibiliDown/compare/V6.35...V6.36)
* V6.35
* V6.35 `2024-09-25`
* 修复:解决配置面板修改配置后无法保存的问题 #216
* 其它详见[V6.34...V6.35](https://github.com/nICEnnnnnnnLee/BilibiliDown/compare/V6.34...V6.35)
* V6.34
* V6.34 `2024-09-03`
该版本主要用来解决某些使用上的问题,如果您已经可以正常使用,可以忽略该更新。
* 精简jre支持的https加密套件有限,不支持ecc。这会导致默认的ffmpeg源bitbucket下载失败。随着网站加密套件的更新,未来或许还会有更多的`TLS handshake failure`
这个问题在旧版本可以通过更换ffmpeg源,或者自行获取ffmpeg并在程序设置好path的方式来解决。
Expand Down
14 changes: 14 additions & 0 deletions src/nicelee/bilibili/exceptions/NoSubtitleException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package nicelee.bilibili.exceptions;

public class NoSubtitleException extends BilibiliError{

private static final long serialVersionUID = -154799775624722132L;

public NoSubtitleException(String message) {
super(message);
}

public NoSubtitleException(String message, Throwable cause) {
super(message, cause);
}
}
23 changes: 12 additions & 11 deletions src/nicelee/bilibili/parsers/impl/AbstractBaseParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.json.JSONArray;
import org.json.JSONObject;

import nicelee.bilibili.API;
import nicelee.bilibili.enums.DownloadModeEnum;
import nicelee.bilibili.exceptions.ApiLinkQueryParseError;
import nicelee.bilibili.exceptions.NoSubtitleException;
import nicelee.bilibili.exceptions.QualityTooLowException;
import nicelee.bilibili.model.ClipInfo;
import nicelee.bilibili.model.StoryClipInfo;
Expand Down Expand Up @@ -249,27 +249,28 @@ protected String getAudioLink(String auId, String _auId, int qn) {
}

protected String getVideoSubtitleLink(String bvId, String cid, int qn) {
String url = String.format("https://api.bilibili.com/x/player.so?id=cid:%s&bvid=%s", cid, bvId);
String url = String.format("https://api.bilibili.com/x/player/wbi/v2?bvid=%s&cid=%s&isGaiaAvoided=false", bvId, cid);
url += API.genDmImgParams();
url = API.encWbi(url);
Logger.println(url);
HashMap<String, String> headers_json = new HttpHeaders().getBiliJsonAPIHeaders(bvId);
String xml = util.getContent(url, headers_json, HttpCookies.globalCookiesWithFingerprint());
Pattern p = Pattern.compile("<subtitle>(.*?)</subtitle>");
Matcher matcher = p.matcher(xml);
if (matcher.find()) {
paramSetter.setRealQN(qn);
JSONArray subList = new JSONObject(matcher.group(1)).getJSONArray("subtitles");
String result = util.getContent(url, headers_json, HttpCookies.globalCookiesWithFingerprint());
paramSetter.setRealQN(qn);
try {
JSONArray subList = new JSONObject(result).getJSONObject("data").getJSONObject("subtitle").getJSONArray("subtitles");
for (int i = 0; i < subList.length(); i++) {
JSONObject sub = subList.getJSONObject(i);
String subLang = sub.getString("lan");
if (Global.cc_lang.equals(subLang)) {
return "https:" + sub.getString("subtitle_url");
}
}

return "https:" + subList.getJSONObject(0).getString("subtitle_url");
} catch (Exception e) {
String tips = Global.isLogin? "未能找到字幕 " + bvId : "未能找到字幕,这可能是没有登录造成的。" + bvId;
throw new NoSubtitleException(tips, e);
}

return null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/nicelee/bilibili/util/batchdownload/Condition.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String toString() {
return left + operator + right;
}

final static SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd");
final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

public boolean match(ClipInfo clip, int page) {
switch (left) {
Expand Down
2 changes: 1 addition & 1 deletion src/nicelee/ui/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public class Global {
// 界面显示相关
@Config(key = "bilibili.version", defaultValue = "v6.36", warning = false)
@Config(key = "bilibili.version", defaultValue = "v6.37", warning = false)
public static String version; // 一般情况下,我们不会设置这个标签,这个用于测试
@Config(key = "bilibili.time.syncServer", note = "同步服务器的时间", defaultValue = "false", valids = { "true", "false" })
public static boolean syncServerTime;
Expand Down

0 comments on commit 34bd3a7

Please sign in to comment.