From 03164bcb6f7831c4d384d705cce0c37e8d860ab0 Mon Sep 17 00:00:00 2001 From: jsz14 Date: Sat, 2 Sep 2023 19:58:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B2=A1=E6=9C=89=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=88=B0=E6=89=80=E6=9C=89=E7=89=88=E6=9C=AC=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/谷歌检索小助手.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crazy_functions/谷歌检索小助手.py b/crazy_functions/谷歌检索小助手.py index 55cebab..d8222c2 100644 --- a/crazy_functions/谷歌检索小助手.py +++ b/crazy_functions/谷歌检索小助手.py @@ -57,9 +57,9 @@ def get_meta_information(url, chatbot, history): except: citation = 'cited by 0' abstract = result.select_one(".gs_rs").text.strip() # 摘要在 .gs_rs 中的文本,需要清除首尾空格 - other_versions = next((tag['href'] for tag in result.select_one('.gs_flb').select('.gs_nph') if 'cluster' in tag['href']), None) # 获取所有版本的链接 - search = search_all_version('http://' + urlparse(url).netloc + other_versions) try: + other_versions = next((tag['href'] for tag in result.select_one('.gs_flb').select('.gs_nph') if 'cluster' in tag['href']), None) # 获取所有版本的链接 + search = search_all_version('http://' + urlparse(url).netloc + other_versions) if search: paper = next(search.results()) abstract = paper.summary.replace('\n', ' ')