fix 豆瓣图片加载

This commit is contained in:
Theluyuan 2023-07-12 14:51:00 +08:00
parent ce408dce8b
commit e8cd3f20ba
3 changed files with 17 additions and 2 deletions

View File

@ -5,9 +5,23 @@ const KoaSSEStream = require('koa-sse-stream');
const {dowload} = require("../util/download");
const {addDownList, getDownList, setDownState} = require("../util/sql/download");
const {getMediaInfo} = require("../util/utils");
const axios = require("axios");
const router = new Router()
// const download = []
// 豆瓣img代理
router.get("/doubanImg",async (ctx)=>{
let url = ctx.query.url
let res = await axios.get(url,{
proxy:false,
headers:{
Referer: "https://movie.douban.com/"
},
responseType:"stream"
})
ctx.body = res.data
})
router.get("/test", async (ctx) => {
let res = await utils.uploadImg('C:/Users/11629/Desktop/80032464_p0.jpg')

View File

@ -7,6 +7,7 @@ async function search(name) {
})
return {
data: list.data.map(d => {
d.img = "http://127.0.0.1:3050/doubanImg?url=" + d.img
return {
...d,
link: `https://movie.douban.com/subject/${d.id}/`

View File

@ -1,5 +1,5 @@
import axios from "axios";
export const base = axios.create({
baseURL:"http://127.0.0.1:3050"
})
baseURL:import.meta.env.DEV ? "http://127.0.0.1:3050" : ""
})