add 优化代码,新增获取腾讯视频播放列表
This commit is contained in:
@@ -4,10 +4,9 @@ const utils = require("../util/utils")
|
||||
const KoaSSEStream = require('koa-sse-stream');
|
||||
const {dowload} = require("../util/download");
|
||||
const {addDownList, getDownList, setDownState} = require("../util/sql/download");
|
||||
const dayjs = require("dayjs")
|
||||
const {getMediaInfo} = require("../util/utils");
|
||||
const router = new Router()
|
||||
// const dowloadlist = []
|
||||
// const download = []
|
||||
|
||||
router.get("/getMediaInfo", async (ctx) => {
|
||||
let url = ctx.query.filePath
|
||||
@@ -26,22 +25,21 @@ router.get("/getMediaInfo", async (ctx) => {
|
||||
|
||||
router.get("/getQqList", async (ctx) => {
|
||||
let url = ctx.query.url
|
||||
let videoid = url.split("/")
|
||||
for (let i in videoid) {
|
||||
if (videoid[i] == "cover") {
|
||||
videoid = videoid[i + 1].replace(".html")
|
||||
let video_id = url.split("/")
|
||||
for (let i in video_id) {
|
||||
if (video_id[i] === "cover") {
|
||||
video_id = video_id[i + 1].replace(".html")
|
||||
break
|
||||
}
|
||||
}
|
||||
let list = await getQqListData(url)
|
||||
ctx.body = list
|
||||
ctx.body = await getQqListData(url)
|
||||
})
|
||||
|
||||
router.get("/startDown", async (ctx) => {
|
||||
let title = ctx.query.title
|
||||
let url = ctx.query.url
|
||||
let save = ctx.query.save
|
||||
// dowloadlist.push({
|
||||
// download.push({
|
||||
// title,url,save
|
||||
// })
|
||||
// startDown()
|
||||
@@ -53,7 +51,12 @@ router.get("/startDown", async (ctx) => {
|
||||
})
|
||||
|
||||
router.get("/test", async (ctx) => {
|
||||
utils.getVideoSpecifyTimeImage("D:/aaa/梦中的那片海/梦中的那片海 第01集.mp4", 46, "D:/aaa/梦中的那片海/aaa.jpg")
|
||||
let rep = await utils.getTencentVideoPlayList('mzc00200t7i1qwp')
|
||||
ctx.body = {
|
||||
code: 0,
|
||||
msg: "test",
|
||||
data: rep
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -92,9 +95,9 @@ function startDown(data) {
|
||||
|
||||
setInterval(async () => {
|
||||
let dowloadlist = await getDownList()
|
||||
if (dowloadlist.length != 0 && !start) {
|
||||
if (dowloadlist.length !== 0 && !start) {
|
||||
startDown(dowloadlist[0])
|
||||
} else if (dowloadlist.length == 0) {
|
||||
} else if (dowloadlist.length === 0) {
|
||||
start = false
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
Reference in New Issue
Block a user