You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Google Scholar Organic Results API获取完整摘要片段?

解决Google Scholar Organic Results API返回截断摘要的问题

问题说明

当前调用API查询研究论文时,返回的摘要片段被截断,示例输出的英文原文翻译为:

整流激活单元(整流器)是最先进神经网络的核心组件。在这项研究中,我们从两个维度探究用于图像分类的整流器神经网络。首先,我们提出参数化整流线性单元(PReLU),作为传统整流单元的泛化版本。PReLU能在几乎无额外计算成本、过拟合风险极低的前提下,提升模型拟合能力。其次,我们推导了一种稳健的初始化方法,专门针对整流器的非线性特性设计。这种方法让我们能够训练极深的整流模型……

解决方案

方法1:添加API扩展视图参数

在请求参数中加入"view_opts": "expanded",该参数会触发API返回扩展版摘要,大幅减少截断情况。修改后的代码如下:

from serpapi import GoogleSearch

params = {
  "engine": "google_scholar",
  "q": "Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification",
  "api_key": "key",
  "view_opts": "expanded"  # 新增扩展视图参数
}

search = GoogleSearch(params)
results = search.get_dict()

print(results['organic_results'][0]['snippet'])

方法2:从论文原始页面提取完整摘要

如果API仍无法返回完整内容,可通过结果中的link字段获取论文原始页面,再提取完整摘要。示例代码:

from serpapi import GoogleSearch
import requests
from bs4 import BeautifulSoup

params = {
  "engine": "google_scholar",
  "q": "Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification",
  "api_key": "key"
}

search = GoogleSearch(params)
results = search.get_dict()
paper_link = results['organic_results'][0]['link']

# 请求论文原始页面
response = requests.get(paper_link)
soup = BeautifulSoup(response.text, 'html.parser')

# 根据页面结构提取摘要(不同网站可能需要调整选择器)
full_snippet = soup.find('div', class_='abstract').get_text(strip=True)
print(full_snippet)

注:第二种方法需根据目标页面的HTML结构调整选择器,同时注意目标网站的反爬限制。

内容的提问来源于stack exchange,提问作者Rohan Shah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 10:22:24