B站模块:修复字幕过大的问题
B站模块:修复仅下载前6分钟字幕的问题
This commit is contained in:
@@ -154,12 +154,15 @@ public class BiliVideo extends Model {
|
||||
json.put("oid", cid);
|
||||
json.put("avid", avid);
|
||||
json.put("segment_index", segment_index);
|
||||
byte[] http = BiliBiliUtils.http("https://api.bilibili.com/x/v2/dm/web/seg.so?" + HttpTools.toUrlParams(json), BiliBiliUtils.HTTP.GET, null, BiliBiliUtils.RET_MODEL.BYTE);
|
||||
try {
|
||||
VideoDanMu.DmSegMobileReply parse = VideoDanMu.DmSegMobileReply.parseFrom(http);
|
||||
List<VideoDanMu.DanmakuElem> tmp, danmuList = new ArrayList<>();
|
||||
while (!(tmp = getDanmu(json)).isEmpty()) {
|
||||
danmuList.addAll(tmp);
|
||||
json.put("segment_index",++segment_index);
|
||||
}
|
||||
AssTools tools = new AssTools(title);
|
||||
List<DanmuData> list = new ArrayList<>();
|
||||
for (VideoDanMu.DanmakuElem elem : parse.getElemsList()) {
|
||||
for (VideoDanMu.DanmakuElem elem : danmuList) {
|
||||
DanmuData danmuData = new DanmuData();
|
||||
danmuData.setDanmu(elem.getContent());
|
||||
danmuData.setFontSize(elem.getFontsize());
|
||||
@@ -176,6 +179,18 @@ public class BiliVideo extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
private List<VideoDanMu.DanmakuElem> getDanmu(JSONObject json) {
|
||||
try {
|
||||
byte[] http = BiliBiliUtils.http("https://api.bilibili.com/x/v2/dm/web/seg.so?" + HttpTools.toUrlParams(json), BiliBiliUtils.HTTP.GET, null, BiliBiliUtils.RET_MODEL.BYTE);
|
||||
VideoDanMu.DmSegMobileReply parse = VideoDanMu.DmSegMobileReply.parseFrom(http);
|
||||
return parse.getElemsList();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void save(String name, File videoFile, File audioFile) {
|
||||
List<String> urls = new ArrayList<>();
|
||||
@@ -263,9 +278,10 @@ public class BiliVideo extends Model {
|
||||
//video.downVideo("https://www.bilibili.com/video/BV1qF411T7Vf?spm_id_from=444.41.list.card_archive.click");
|
||||
//唐诱正片
|
||||
//video.downVideo("https://www.bilibili.com/video/BV1L44y147zR?spm_id_from=333.337.search-card.all.click");
|
||||
video.downVideo("https://www.bilibili.com/video/BV18L4y1H7rz?spm_id_from=333.999.0.0");
|
||||
// video.downVideo("https://www.bilibili.com/video/BV18L4y1H7rz?spm_id_from=333.999.0.0");
|
||||
// int a=16|2048;
|
||||
// System.out.println("a = " + a);
|
||||
//video.downDanmu(428855000L,976216102L,"【都市_情感】《唐可可的诱惑》第一集",1);
|
||||
video.downDanmu(711506339L, 641094440L, "泡泡", 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user