获取英文名
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
const Router = require("koa-router")
|
||||
const { serach, gen_douban } = require("../util/ptgen")
|
||||
const axios = require("axios")
|
||||
const cheerio = require("cheerio"); // HTML页面解析
|
||||
|
||||
const router = new Router({
|
||||
prefix:"/videoInfo"
|
||||
prefix: "/videoInfo"
|
||||
})
|
||||
|
||||
|
||||
router.get("/search",async (ctx)=>{
|
||||
router.get("/search", async (ctx) => {
|
||||
let name = ctx.query.name
|
||||
ctx.body = await serach(name)
|
||||
})
|
||||
@@ -17,15 +19,15 @@ router.get("/search",async (ctx)=>{
|
||||
// ctx.body = info
|
||||
// })
|
||||
|
||||
router.get("/searchVideo",async (ctx)=>{
|
||||
router.get("/searchVideo", async (ctx) => {
|
||||
let name = ctx.query.name
|
||||
ctx.body = await serach(name)
|
||||
|
||||
})
|
||||
|
||||
router.get("/getVideoInfo",async (ctx)=>{
|
||||
router.get("/getVideoInfo", async (ctx) => {
|
||||
let id = ctx.query.id
|
||||
if(!id){
|
||||
if (!id) {
|
||||
ctx.body = "请传递id"
|
||||
return
|
||||
}
|
||||
@@ -33,4 +35,22 @@ router.get("/getVideoInfo",async (ctx)=>{
|
||||
|
||||
})
|
||||
|
||||
router.post("/addSubscribe", async (ctx) => {
|
||||
// console.log(ctx.request.body)
|
||||
let data = ctx.request.body
|
||||
})
|
||||
|
||||
router.get("/getImdbName", async (ctx) => {
|
||||
let res = await axios.get(ctx.query.url, {
|
||||
proxy: false,
|
||||
headers:{
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67"
|
||||
}
|
||||
})
|
||||
|
||||
// console.log(res.data)
|
||||
let $ = cheerio.load(res.data)
|
||||
ctx.body = $("h1").text()
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user