diff --git a/db/database.db b/db/database.db index e1d032f..1ebfb4b 100644 Binary files a/db/database.db and b/db/database.db differ diff --git a/router/videoInfo.js b/router/videoInfo.js index dbd0cd9..a7dc45d 100644 --- a/router/videoInfo.js +++ b/router/videoInfo.js @@ -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 \ No newline at end of file diff --git a/view/src/api/Video.js b/view/src/api/Video.js index 1fa8c9b..7e3442a 100644 --- a/view/src/api/Video.js +++ b/view/src/api/Video.js @@ -1,16 +1,30 @@ -import { base } from "./base"; -export async function getVideoInfo(id){ - return await base.get("/videoInfo/getVideoInfo",{ - params:{ +import {base} from "./base"; + +export async function getVideoInfo(id) { + return await base.get("/videoInfo/getVideoInfo", { + params: { id } }) } -export async function searchVideo(name){ - return await base.get("/videoInfo/searchVideo",{ - params:{ +export async function searchVideo(name) { + return await base.get("/videoInfo/searchVideo", { + params: { name } }) } + + +export async function getImdbName(url) { + return await base.get("/videoInfo/getImdbName", { + params: { + url + } + }) +} + +export async function addSubscribe({name, desc, year, season, ep, url}) { + return await base.post("/videoInfo/addSubscribe", {name, desc, year, season, ep, url}) +} \ No newline at end of file diff --git a/view/src/page/subscribe/addSubscribe.vue b/view/src/page/subscribe/addSubscribe.vue index 3831ac3..3673a29 100644 --- a/view/src/page/subscribe/addSubscribe.vue +++ b/view/src/page/subscribe/addSubscribe.vue @@ -17,11 +17,26 @@ +
+ 英文名: + + 年份 + + 第几季 + + 开始集数 + + +
+
+ 地址: + +
@@ -31,14 +46,17 @@