add:新增B站视频下载接口及页面

This commit is contained in:
2022-08-15 02:24:49 +08:00
parent 8160d64867
commit e19d1cdeda
4 changed files with 227 additions and 37 deletions

View File

@@ -51,7 +51,7 @@ public class AppTools {
printWriter.close();
return writer.toString();
}
public static void exec(String exec, ObjectInterface objectInterface, boolean isOutQQBot, boolean isInput) {
public static String exec(String exec, ObjectInterface objectInterface, boolean isOutQQBot, boolean isInput) {
try {
Process process;
if (AppTools.isRuntimeSystemOfWindow()) {
@@ -69,17 +69,20 @@ public class AppTools {
}
);
}
String ret;
if (isInput) {
processOut(process.getInputStream(), objectInterface, isOutQQBot);
ret=processOut(process.getInputStream(), objectInterface, isOutQQBot);
processOut(process.getErrorStream(),null,isOutQQBot);
} else {
processOut(process.getErrorStream(), objectInterface, isOutQQBot);
ret=processOut(process.getErrorStream(), objectInterface, isOutQQBot);
processOut(process.getInputStream(),null,isOutQQBot);
}
process.destroy();
return ret;
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
public static boolean isRuntimeSystemOfWindow() {
@@ -121,7 +124,7 @@ public class AppTools {
public static void processOut(InputStream inputStream) {
processOut(inputStream,null,true);
}
public static void processOut(InputStream inputStream, ObjectInterface objectInterface, boolean isOutQQBot){
public static String processOut(InputStream inputStream, ObjectInterface objectInterface, boolean isOutQQBot){
String tmp;
StringBuilder str = new StringBuilder();
try {
@@ -141,6 +144,7 @@ public class AppTools {
if(isOutQQBot) {
QQBotManager.getInstance().sendMessage(str.toString());
}
return str.toString();
}
public static void sendServer(String title, String msg) {
try {