From 7481f6c74b54c0c89c39338aed38d7248adfbae5 Mon Sep 17 00:00:00 2001 From: Kagura Date: Mon, 25 Nov 2024 20:34:48 +0800 Subject: [PATCH] RandomAnimeGirl: let's get it work --- src/RandomAnimeGirl.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/RandomAnimeGirl.tsx b/src/RandomAnimeGirl.tsx index 60403fb..1a3ba46 100644 --- a/src/RandomAnimeGirl.tsx +++ b/src/RandomAnimeGirl.tsx @@ -88,10 +88,10 @@ async function getImage(data: ApiResponse): Promise { if (data.source == undefined || data.source.direct == null) { return null } - const url = data.source.direct.replace('i.pximg.net', 'p.lolicon.cyou') + const url = data.source.direct.replace('i.pximg.net', 'pixiv.lolicon.cyou') let result: Blob | null = null - const response = await fetch(url, { method: "GET" }) + const response = await fetch(url, { method: "GET" ,redirect: 'follow'}) if (response.status != 200) { if (response.status == 404 && data.image != undefined) { // 尝试使用备用的 @@ -127,8 +127,7 @@ function handleGetImage(type: string | null, setter: React.Dispatch { try { const result = await api.getFromEndpoint(endpoint) - const image = null - // const image = await getImage(result) + const image = await getImage(result) if (image != null) { setter(URL.createObjectURL(image)); } else {