ptSend/router/videoInfo.js

36 lines
702 B
JavaScript

const Router = require("koa-router")
const { serach, gen_douban } = require("../util/ptgen")
const router = new Router({
prefix:"/videoInfo"
})
router.get("/search",async (ctx)=>{
let name = ctx.query.name
ctx.body = await serach(name)
})
// router.get("/getinfo",async (ctx)=>{
// let url = ctx.query.url
// let info = await getinfo(url)
// ctx.body = info
// })
router.get("/searchVideo",async (ctx)=>{
let name = ctx.query.name
ctx.body = await serach(name)
})
router.get("/getVideoInfo",async (ctx)=>{
let id = ctx.query.id
if(!id){
ctx.body = "请传递id"
return
}
ctx.body = await gen_douban(id)
})
module.exports = router