mcpField
W
wos-paper-detail

wos-paper-detail

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

关于 wos-paper-detail

wos-paper-detail 是用于读取 Web of Science 完整记录的技能,面向需要整理论文元数据的研究工作流。它可从 WoS 编号或完整 URL 定位记录,并提取标题、作者、摘要、引用等字段。

主要功能

  1. 01按 WoS 编号或 URL 定位记录
  2. 02提取论文完整元数据
  3. 03读取摘要、关键词和引用信息
  4. 04按结构化格式呈现结果

适用场景

  1. 01整理指定论文的书目信息
  2. 02查看论文摘要、关键词和引用数

安装

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

$npx skills add https://github.com/cookjohn/wos-skills --skill wos-paper-detail

安装后在 Claude Code 中输入/wos-paper-detail确认已加载。

详细介绍

WoS 论文详情

导航至 WoS 完整记录页面并提取全面的论文元数据。

步骤

步骤 1:解析输入

接受以下任一输入:

  • WoS 入藏号:WOS:000779183600001
  • 完整 URL:https://www.webofscience.com/wos/woscc/full-record/WOS:000779183600001

如果提供的是完整 URL,则提取 WoS ID。

步骤 2:导航
navigate_page({
  url: "{BASE_URL}/wos/woscc/full-record/{WOS_ID}",
  initScript: "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"
})
步骤 3:提取完整记录数据
async () => {
  // Wait for full record to load
  for (let i = 0; i < 30; i++) {
    if (document.querySelector('[data-ta="FullRTa-fullRecordtitle-0"]')) break;
    await new Promise(r => setTimeout(r, 500));
  }
  await new Promise(r => setTimeout(r, 1500));

  // Check access
  if (document.body.innerText.includes('Sign in') && !document.querySelector('[data-ta="FullRTa-fullRecordtitle-0"]')) {
    return { status: 'login_required' };
  }

  // Helper: get value for a labeled field (h3 label -> parent's non-h3 children)
  const getField = (label) => {
    const h3 = [...document.querySelectorAll('h3')].find(h => h.textContent.trim() === label);
    if (!h3) return '';
    const parent = h3.parentElement;
    const valueEls = [...parent.children].filter(el => el.tagName !== 'H3');
    return valueEls.map(s => s.textContent?.trim()).join(' ').substring(0, 300) || '';
  };

  // Title
  const title = document.querySelector('[data-ta="FullRTa-fullRecordtitle-0"]')?.textContent?.trim() || '';

  // Authors
  const authors = [...document.querySelectorAll('[data-ta^="SumAuthTa-DisplayName-author-en"]')]
    .map(a => a.textContent?.trim());

  // Abstract
  const abstract = document.querySelector('div.abstract--instance')?.textContent?.trim() || '';

  // Source/Journal - extract only journal name from the JCR sidenav component
  let source = '';
  const sourceSpan = document.querySelector('h3[data-ta="FullRTa-sourceLabel"]')?.parentElement?.querySelector('span.section-label-data');
  if (sourceSpan) {
    // The span contains app-jcr-sidenav with journal name + popup. Get first text content before "arrow_back"
    const fullText = sourceSpan.textContent?.trim() || '';
    source = fullText.split('arrow_back')[0].trim();
  }
  if (!source) {
    source = document.querySelector('.summary-source-title-link')?.firstChild?.textContent?.trim() || '';
  }

  // DOI - try link first, fall back to h3 label extraction
  const doiEl = document.querySelector('a[href*="doi.org"]');
  const doi = doiEl?.textContent?.trim() || doiEl?.href?.replace(/.*doi\.org\//, '') || getField('DOI');

  // Metadata fields
  const volume = getField('Volume');
  const issue = getField('Issue');
  const pages = getField('Page');
  const published = getField('Published');
  const earlyAccess = getField('Early Access');
  const docType = getField('Document Type');
  const language = getField('Language');
  const accessionNumber = getField('Accession Number');
  const issn = getField('ISSN');
  const eissn = getField('eISSN');

  // Keywords - use parentElement.querySelectorAll('a') to get ALL keyword links
  const getKeywords = (label) => {
    const h3 = [...document.querySelectorAll('h3')].find(h => h.textContent.trim() === label);
    if (!h3) return [];
    return [...h3.parentElement.querySelectorAll('a')].map(a => a.textContent?.trim()).filter(Boolean);
  };
  const authorKeywords = getKeywords('Author Keywords');
  const keywordsPlus = getKeywords('Keywords Plus');

  // Categories
  const researchAreas = getField('Research Areas');
  const wosCategories = getField('Web of Science Categories');

  // Citations - full record page uses FullRRPTa selectors, NOT stat-number selectors
  const citedLinks = [...document.querySelectorAll('a[data-ta*="times-cited-count-link"]')];
  // WOSCC link text is "992 In Web of Science Core Collection" - extract leading number
  const extractNum = (text) => (text?.match(/^[\d,]+/) || ['0'])[0];
  const wosccCited = extractNum(citedLinks.find(a => a.getAttribute('data-ta')?.includes('-WOSCC'))?.textContent?.trim());
  const alldbCited = extractNum(citedLinks.find(a => a.getAttribute('data-ta')?.includes('-ALLDB'))?.textContent?.trim());
  const mainCited = extractNum(citedLinks.find(a => /^\d/.test(a.textContent?.trim()))?.textContent?.trim());
  const citedCount = wosccCited || mainCited || '0';

  // References
  const refsCount = document.querySelector('a[data-ta*="refCountLink"]')?.textContent?.trim() || '0';

  // JIF - extract from JCR popup/sidenav text content
  let jif = '', jifYear = '', jifFiveYear = '', jcrQuartile = '';
  const jcrPopup = document.querySelector('[class*="journal-content"], app-jcr-sidenav');
  if (jcrPopup) {
    const jcrText = jcrPopup.textContent || '';
    // Pattern: "Journal Impact Factor ™20242.8Five Year3.4"
    const jifMatch = jcrText.match(/Impact Factor\s*(?:™|TM)?\s*(\d{4})\s*([\d.]+)/);
    if (jifMatch) { jifYear = jifMatch[1]; jif = jifMatch[2]; }
    const fyMatch = jcrText.match(/Five Year\s*([\d.]+)/);
    if (fyMatch) jifFiveYear = fyMatch[1];
    // Quartile: "159/316 Q3" pattern in JCR summary
    const qMatch = jcrText.match(/\d+\/\d+\s*(Q[1-4])/);
    if (qMatch) jcrQuartile = qMatch[1];
  }

  // Full text links
  const ftLinks = [...document.querySelectorAll('a[data-ta^="FRLinkTa"]')].map(a => ({
    text: a.textContent?.trim()?.replace(/open_in_new/g, '').trim(),
    href: a.href
  })).filter(l => l.text);

  return {
    status: 'ok',
    title, authors, abstract, source, doi,
    volume, issue, pages, published, earlyAccess,
    docType, language, accessionNumber, issn, eissn,
    authorKeywords, keywordsPlus,
    researchAreas, wosCategories,
    citedCount, alldbCited, refsCount,
    jif, jifYear, jifFiveYear, jcrQuartile,
    ftLinks
  };
}
步骤 4:呈现结果

将输出格式化为结构化摘要:

## {Title}

**Authors**: {authors joined by "; "}
**Source**: {source}, Vol. {volume}, Iss. {issue}, pp. {pages}
**Published**: {published}
**DOI**: {doi}
**Document Type**: {docType}
**WoS ID**: {accessionNumber}

### Abstract
{abstract}

### Keywords
- **Author Keywords**: {authorKeywords}
- **Keywords Plus**: {keywordsPlus}

### Metrics
- **Times Cited (WOSCC)**: {citedCount}
- **Times Cited (All DB)**: {alldbCited}
- **References**: {refsCount}
- **JIF ({jifYear})**: {jif} (Five Year: {jifFiveYear})
- **JCR Quartile**: {jcrQuartile}

### Classification
- **Research Areas**: {researchAreas}
- **WoS Categories**: {wosCategories}
- **ISSN**: {issn} | **eISSN**: {eissn}

### Full Text Links
{list of ftLinks}

提供后续操作:

  • “使用 /wos-export {WoS ID} 导出此论文”
  • “使用 /wos-download {WoS ID} 下载 PDF”

关键 CSS 选择器(完整记录页面)

元素选择器备注
标题[data-ta="FullRTa-fullRecordtitle-0"]
作者[data-ta^="SumAuthTa-DisplayName-author-en"]
摘要div.abstract--instance
来源标签h3[data-ta="FullRTa-sourceLabel"]父级 span 包含 JCR 弹窗;按 "arrow_back" 分割
DOIa[href*="doi.org"]
作者关键词h3#FRkeywordsTa-authorKeywordsLabel → 父级 a 标签使用 parentElement.querySelectorAll('a')
Keywords Plus使用相同模式和 "Keywords Plus" 标签
引用次数(WOSCC)a[data-ta*="times-cited-count-link-WOSCC"]仅限完整记录页面
引用次数(所有数据库)a[data-ta*="times-cited-count-link-ALLDB"]仅限完整记录页面
参考文献a[data-ta*="refCountLink"]仅限完整记录页面
元数据字段h3 标签 → parentElement → 非 h3 子元素卷、期、页码、发表日期等
JIFapp-jcr-sidenav 内的文本内容正则表达式:/Impact Factor\s*™?\s*(\d{4})\s*([\d.]+)/
全文链接a[data-ta^="FRLinkTa"]

注意事项

  • 此技能使用 2 次工具调用:navigate_page + evaluate_script
  • 重要:完整记录页面使用的引用选择器与搜索结果页面不同:
    • 搜索结果:a[data-ta="stat-number-citation-related-count"]
    • 完整记录:a[data-ta*="times-cited-count-link-WOSCC"]
  • 来源提取必须按 "arrow_back" 分割,以避免捕获 JCR 弹窗内容
  • 关键词必须使用 parentElement.querySelectorAll('a'),不能使用 nextElementSibling
  • JIF 嵌入在 JCR 侧边导航弹窗文本中,不在独立元素内

评论

支持 Markdown