B站模块:修复字幕过大的问题
B站模块:修复仅下载前6分钟字幕的问题
This commit is contained in:
parent
a7baf2a236
commit
c1fd29232e
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version="QQBot v.1.2.27";
|
public static final String version="QQBot v.1.2.28";
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
SpringApplication.run(QQBotApplication.class, args);
|
SpringApplication.run(QQBotApplication.class, args);
|
||||||
|
@ -49,15 +49,15 @@ public class AssTools {
|
|||||||
addBuilder("Original Script: 本字幕由@yutou生成");
|
addBuilder("Original Script: 本字幕由@yutou生成");
|
||||||
addBuilder("ScriptType: v4.00+");
|
addBuilder("ScriptType: v4.00+");
|
||||||
addBuilder("Collisions: Normal");
|
addBuilder("Collisions: Normal");
|
||||||
addBuilder("PlayResX: 560");
|
addBuilder("PlayResX: 1920");
|
||||||
addBuilder("PlayResY: 420");
|
addBuilder("PlayResY: 1080");
|
||||||
addBuilder("Timer: 10.0000");
|
addBuilder("Timer: 10.0000");
|
||||||
addBuilder("");
|
addBuilder("");
|
||||||
addBuilder("[V4+ Styles]");
|
addBuilder("[V4+ Styles]");
|
||||||
addBuilder("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, ");
|
addBuilder("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, ");
|
||||||
addBuilder("MarginL, MarginR, MarginV, Encoding");
|
addBuilder("MarginL, MarginR, MarginV, Encoding");
|
||||||
addBuilder("Style: Fix,Microsoft YaHei UI,25,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,1,0,0,0,100,100,0,0,1,2,0,2,20,20,2,0");
|
addBuilder("Style: Fix,Microsoft YaHei UI,45,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,1,0,0,0,100,100,0,0,1,2,0,2,20,20,2,0");
|
||||||
addBuilder("Style: R2L,Microsoft YaHei UI,14,&H00FFFFFF,&H000000FF,&H00161616,&H00000000,0,0,0,0,100,100,0,0,1,2,0,2,20,20,20,1");
|
addBuilder("Style: R2L,Microsoft YaHei UI,45,&H00FFFFFF,&H000000FF,&H00161616,&H00000000,0,0,0,0,100,100,0,0,1,2,0,2,20,20,20,1");
|
||||||
addBuilder("");
|
addBuilder("");
|
||||||
addBuilder("[Events]");
|
addBuilder("[Events]");
|
||||||
addBuilder("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
addBuilder("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
||||||
@ -141,7 +141,7 @@ public class AssTools {
|
|||||||
new DecimalFormat("00").format(m),
|
new DecimalFormat("00").format(m),
|
||||||
new DecimalFormat("00").format(s));
|
new DecimalFormat("00").format(s));
|
||||||
float x1, x2;
|
float x1, x2;
|
||||||
x1 = 560 + (danmuData.getDanmu().length() * 12.5f);
|
x1 = 1920 + (danmuData.getDanmu().length() * 12.5f);
|
||||||
x2 = 0 - (danmuData.getDanmu().length() * 12.5f);
|
x2 = 0 - (danmuData.getDanmu().length() * 12.5f);
|
||||||
|
|
||||||
String ass = String.format("Dialogue: 0,%s,%s,R2L,,20,20,2,,{\\move(%.1f,%d,%.1f,%d)\\c&%s\\alpha&H%s}%s",
|
String ass = String.format("Dialogue: 0,%s,%s,R2L,,20,20,2,,{\\move(%.1f,%d,%.1f,%d)\\c&%s\\alpha&H%s}%s",
|
||||||
@ -160,9 +160,9 @@ public class AssTools {
|
|||||||
|
|
||||||
|
|
||||||
private void addY() {
|
private void addY() {
|
||||||
y += 25;
|
y += 30;
|
||||||
if (y >= 420) {
|
if (y >= 1080) {
|
||||||
y = 25;
|
y = 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,12 +154,15 @@ public class BiliVideo extends Model {
|
|||||||
json.put("oid", cid);
|
json.put("oid", cid);
|
||||||
json.put("avid", avid);
|
json.put("avid", avid);
|
||||||
json.put("segment_index", segment_index);
|
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 {
|
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);
|
AssTools tools = new AssTools(title);
|
||||||
List<DanmuData> list = new ArrayList<>();
|
List<DanmuData> list = new ArrayList<>();
|
||||||
for (VideoDanMu.DanmakuElem elem : parse.getElemsList()) {
|
for (VideoDanMu.DanmakuElem elem : danmuList) {
|
||||||
DanmuData danmuData = new DanmuData();
|
DanmuData danmuData = new DanmuData();
|
||||||
danmuData.setDanmu(elem.getContent());
|
danmuData.setDanmu(elem.getContent());
|
||||||
danmuData.setFontSize(elem.getFontsize());
|
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) {
|
private void save(String name, File videoFile, File audioFile) {
|
||||||
List<String> urls = new ArrayList<>();
|
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/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/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;
|
// int a=16|2048;
|
||||||
// System.out.println("a = " + a);
|
// System.out.println("a = " + a);
|
||||||
//video.downDanmu(428855000L,976216102L,"【都市_情感】《唐可可的诱惑》第一集",1);
|
//video.downDanmu(428855000L,976216102L,"【都市_情感】《唐可可的诱惑》第一集",1);
|
||||||
|
video.downDanmu(711506339L, 641094440L, "泡泡", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user