From f70a441dd8705b8646584de65e1097a3ed1ebc52 Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Sun, 1 Jun 2025 19:42:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=A5=E5=A2=9E=E5=BC=BA=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E6=80=A7=E5=92=8C=E9=94=99=E8=AF=AF=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index af94db0..809aa36 100644 --- a/main.py +++ b/main.py @@ -79,8 +79,15 @@ def get_searchInfo(keyword, level, headers, proxy_name, r=2): 'http': proxy_string, 'https': proxy_string, } - response = requests.get(endpoint, params=params, proxies=proxies) - jsondata = response.json() + try: + response = requests.get(endpoint, params=params, proxies=proxies) + jsondata = response.json() + except Exception as e: + if r < 0: + logger.exception(f"[Requested] 未知:{e}, keyword: {keyword}, l: {level}") + else: + time.sleep((3 - r) * 5) + return get_searchInfo(keyword, level, headers, proxy_name, r - 1) try: resinfo = jsondata.get("list") except Exception: