From 198af52b3b9a9c0414ce2e4b25b5d799b513a61d Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Sat, 19 Jul 2025 17:30:21 +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=E9=81=BF=E5=85=8D=E5=9C=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=85=E4=BA=8B=E6=95=B0=E6=8D=AE=E6=97=B6=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=E6=88=96=E9=94=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oneget.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oneget.py b/oneget.py index 5ae2835..80d0f2d 100644 --- a/oneget.py +++ b/oneget.py @@ -646,7 +646,11 @@ def main(): proxies=proxies) data = response.json() - edges = data['data']['search']['stories']['edges'] + try: + edges = data['data']['search']['stories']['edges'] + except (TypeError,KeyError): + print("stories 为 None 或结构异常,跳过") + return edges_len = len(edges) logger.info(f"第 {i} 页,关键词: {kw},获取到 {edges_len} 条数据") tancks = []