mcpField
G
gs-advanced-search

gs-advanced-search

github.com/cookjohn生产力538231 次安装33 周前更新
代码仓库

关于 gs-advanced-search

gs-advanced-search 将自然语言描述的检索条件转换为 Google Scholar URL 参数并执行搜索,适合需要指定作者、出版物、年份范围或标题范围的文献检索。

主要功能

  1. 01将条件映射为 Scholar URL 参数
  2. 02支持作者和出版物筛选
  3. 03设置年份范围与搜索范围
  4. 04展示构造的查询参数

适用场景

  1. 01查找作者在指定年份范围内的论文
  2. 02在某出版物中搜索主题
  3. 03将词组搜索限制在标题中

MCP 相关

该技能使用 Chrome DevTools MCP 跳转到构造的 Google Scholar 搜索 URL 并提取结果。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/cookjohn/gs-skills --skill gs-advanced-search

安装后在 Claude Code 中输入/gs-advanced-search确认已加载。

详细介绍

Google Scholar 高级搜索

根据用户的自然语言描述,使用 URL 参数构造并执行 Google Scholar 搜索。

参数

$ARGUMENTS 是对搜索条件的自然语言描述,例如:

  • “搜索 2020 年以后 Einstein 关于相对论的论文”
  • “查找 Nature 上关于 CRISPR 的综述”
  • “仅在标题中搜索精确短语 ‘machine learning’”

第 1 步:将搜索条件解析为 URL 参数

将用户的意图映射到 Google Scholar URL 参数:

条件参数示例
关键词qq=gastric+cancer
作者as_sauthorsas_sauthors="Albert Einstein"
期刊/来源as_publicationas_publication=Nature
起始年份as_yloas_ylo=2020
结束年份as_yhias_yhi=2025
精确短语as_epqas_epq=machine+learning
以下任一词语(OR)as_oqas_oq=immunotherapy+checkpoint
排除词语as_eqas_eq=review
搜索范围as_occtas_occt=title(仅标题)/ as_occt=any(任意位置)
每页结果数numnum=10(默认值)或 num=20(最大值)
语言hlhl=en 或 hl=zh-CN

构造示例:

  • “Einstein 2020 年以后在 Nature 上的论文” → scholar?as_sauthors=Einstein&as_publication=Nature&as_ylo=2020&hl=en
  • “标题包含 CRISPR 的论文” → scholar?q=CRISPR&as_occt=title&hl=en
  • “精确搜索 ‘deep learning’,排除 review” → scholar?as_epq=deep+learning&as_eq=review&hl=en
  • “搜索 immunotherapy 或 checkpoint 相关论文” → scholar?as_oq=immunotherapy+checkpoint&hl=en

注意:

  • 使用 as_sauthors、as_publication 等参数时,可以省略 q,也可以用它添加其他关键词
  • 始终包含 hl=en,以确保结果一致
  • 使用 num=10(默认值)以降低触发 CAPTCHA 的风险

第 2 步:导航

使用 mcp__chrome-devtools__navigate_page:

  • url:https://scholar.google.com/scholar?{CONSTRUCTED_PARAMS}

第 3 步:提取结果(evaluate_script)

与 gs-search 第 2 步使用相同的提取脚本:

async () => {
  for (let i = 0; i < 20; i++) {
    if (document.querySelector('#gs_res_ccl') || document.querySelector('#gs_captcha_ccl')) break;
    await new Promise(r => setTimeout(r, 500));
  }

  if (document.querySelector('#gs_captcha_ccl') || document.body.innerText.includes('unusual traffic')) {
    return { error: 'captcha', message: 'Google Scholar requires CAPTCHA verification. Please complete it in your browser, then tell me to continue.' };
  }

  const items = document.querySelectorAll('#gs_res_ccl .gs_r.gs_or.gs_scl');
  const results = Array.from(items).map((item, i) => {
    const titleEl = item.querySelector('.gs_rt a');
    const meta = item.querySelector('.gs_a')?.textContent || '';
    const parts = meta.split(' - ');
    const authors = parts[0]?.trim() || '';
    const journalYear = parts[1]?.trim() || '';
    const citedByEl = item.querySelector('.gs_fl a[href*="cites"]');

    return {
      n: i + 1,
      title: titleEl?.textContent?.trim() || item.querySelector('.gs_rt')?.textContent?.trim() || '',
      href: titleEl?.href || '',
      authors,
      journalYear,
      citedBy: citedByEl?.textContent?.match(/\d+/)?.[0] || '0',
      citedByUrl: citedByEl?.href || '',
      dataCid: item.getAttribute('data-cid') || '',
      fullTextUrl: (item.querySelector('.gs_ggs a') || item.querySelector('.gs_or_ggsm a'))?.href || '',
      snippet: item.querySelector('.gs_rs')?.textContent?.trim()?.substring(0, 200) || ''
    };
  });

  const totalText = document.querySelector('#gs_ab_md')?.textContent?.trim() || '';
  const currentUrl = window.location.href;
  return { total: totalText, resultCount: results.length, currentUrl, results };
}

第 4 步:报告

Advanced search on Google Scholar:
Query parameters: {list the parameters used}
{total}

1. {title}
   Authors: {authors} | {journalYear}
   Cited by: {citedBy} | [Full text]({fullTextUrl})
   Data-CID: {dataCid}

2. ...

始终显示构造出的 URL 参数,让用户了解查询的构建方式。

注意事项

  • 此技能使用 2 次工具调用:navigate_page + evaluate_script
  • Google Scholar 不支持按出版物类型筛选(综述、临床试验等)——请改用关键词
  • Google Scholar 不提供影响因子——可使用引用次数作为替代指标
  • 与 gs-search 的主要区别在于 URL 参数构造——此技能会将自然语言转换为 Google Scholar 查询参数

评论

支持 Markdown