fix 豆瓣图片加载
This commit is contained in:
parent
ce408dce8b
commit
e8cd3f20ba
@ -5,9 +5,23 @@ const KoaSSEStream = require('koa-sse-stream');
|
|||||||
const {dowload} = require("../util/download");
|
const {dowload} = require("../util/download");
|
||||||
const {addDownList, getDownList, setDownState} = require("../util/sql/download");
|
const {addDownList, getDownList, setDownState} = require("../util/sql/download");
|
||||||
const {getMediaInfo} = require("../util/utils");
|
const {getMediaInfo} = require("../util/utils");
|
||||||
|
const axios = require("axios");
|
||||||
const router = new Router()
|
const router = new Router()
|
||||||
// const download = []
|
// 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) => {
|
router.get("/test", async (ctx) => {
|
||||||
let res = await utils.uploadImg('C:/Users/11629/Desktop/80032464_p0.jpg')
|
let res = await utils.uploadImg('C:/Users/11629/Desktop/80032464_p0.jpg')
|
||||||
|
@ -7,6 +7,7 @@ async function search(name) {
|
|||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
data: list.data.map(d => {
|
data: list.data.map(d => {
|
||||||
|
d.img = "http://127.0.0.1:3050/doubanImg?url=" + d.img
|
||||||
return {
|
return {
|
||||||
...d,
|
...d,
|
||||||
link: `https://movie.douban.com/subject/${d.id}/`
|
link: `https://movie.douban.com/subject/${d.id}/`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export const base = axios.create({
|
export const base = axios.create({
|
||||||
baseURL:"http://127.0.0.1:3050"
|
baseURL:import.meta.env.DEV ? "http://127.0.0.1:3050" : ""
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user