From 7f0b1a111c251eafb2f1df84e3c8ac802246c5f8 Mon Sep 17 00:00:00 2001 From: heziiop <1624120705@qq.com> Date: Sat, 10 Dec 2022 17:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E5=8A=A8=E6=BC=AB?= =?UTF-8?q?=E5=A3=81=E7=BA=B8=E7=9A=84api=EF=BC=8C=E6=97=A7=E7=9A=84api?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- earth_wallpaper/interfaces/anime.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/earth_wallpaper/interfaces/anime.py b/earth_wallpaper/interfaces/anime.py index 3454e01..8400431 100644 --- a/earth_wallpaper/interfaces/anime.py +++ b/earth_wallpaper/interfaces/anime.py @@ -12,11 +12,12 @@ def __init__(self): self.proxies = Settings().proxies() self.download_dir = PlatformInfo().download_dir() self.download_path = None - self.request_url = "https://api.waifu.im/random?orientation=LANDSCAPE" + self.request_url = "https://api.waifu.im/search?orientation=LANDSCAPE" self.img_url = None def get_img_url(self): - res = requests.get(self.request_url, proxies=self.proxies) + headers = {'Accept-Version': 'v4'} + res = requests.get(self.request_url, headers=headers, proxies=self.proxies) if res.ok: res = json.loads(res.text) self.img_url = res["images"][0]["url"]