add:新增B站视频下载接口及页面
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.yutou.qqbot.Controllers;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.qqbot.models.BiliBili.BiliVideo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
public class BiliBiliController {
|
||||
@RequestMapping("/bilibili/down.do")
|
||||
@ResponseBody
|
||||
public JSONObject downloadBili(String data) {
|
||||
new Thread(() -> {
|
||||
JSONObject json = JSONObject.parseObject(data);
|
||||
System.out.println("json = " + json);
|
||||
String url = json.getString("url");
|
||||
boolean downDanmu = json.containsKey("danmu") && "on".equals(json.getString("danmu"));
|
||||
boolean merge = json.containsKey("merge") && "on".equals(json.getString("merge"));
|
||||
BiliVideo video = new BiliVideo();
|
||||
video.downVideo(url, downDanmu, merge);
|
||||
}
|
||||
).start();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("msg", "ok");
|
||||
json.put("code", 0);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user