关于 wos-navigate-pages
wos-navigate-pages 是用于加载 Web of Science 当前检索结果指定页的技能。它支持通过结果页 URL 导航,也可通过搜索 API 沿用原检索设置。
主要功能
- 01加载指定结果页
- 02修改结果页 URL 进行导航
- 03通过搜索 API 获取页面
- 04使用从 1 开始的记录偏移量
适用场景
- 01打开当前检索的后续页面
- 02沿用原检索设置获取指定页
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ cookjohn/ wos-skills --skill wos-navigate-pages安装后在 Claude Code 中输入/wos-navigate-pages确认已加载。
详细介绍
WoS 结果页导航
从当前 WoS 搜索中加载指定的结果页。
两种方法
方法 A:基于 URL(浏览器位于结果页时)
结果页 URL 的模式如下:
/wos/woscc/summary/{session-uuid}/{sort}/{page-number}
修改 URL 中的页码并导航。然后使用 evaluate_script 和 DOM 选择器提取数据。需要 2 次工具调用。
方法 B:基于 API(首选,仅需 1 次工具调用)
使用 retrieve.first 偏移量重新调用搜索 API:
async () => {
const sid = performance.getEntriesByType('resource')
.filter(r => r.name.includes('SID='))
.map(r => r.name.match(/SID=([^&]+)/)?.[1])
.filter(Boolean)[0] || '';
const page = {TARGET_PAGE}; // 1-based
const perPage = 50;
const first = (page - 1) * perPage + 1;
const response = await fetch(`/api/wosnx/core/runQuerySearch?SID=${sid}`, {
method: 'POST',
headers: { 'Content-Type': 'text/plain;charset=UTF-8', 'Accept': 'application/x-ndjson' },
body: JSON.stringify({
"product": "WOSCC",
"searchMode": "general",
"viewType": "search",
"serviceMode": "summary",
"search": {
"mode": "general",
"database": "WOSCC",
"query": [{SAME_QUERY_AS_ORIGINAL_SEARCH}],
"editions": [{SAME_EDITIONS}]
},
"retrieve": {
"first": first,
"count": perPage,
"history": false,
"jcr": true,
"sort": "{SAME_SORT}",
"analyzes": [],
"locale": "en"
},
"eventMode": null
})
});
const text = await response.text();
const lines = text.trim().split('\n').map(l => { try { return JSON.parse(l); } catch(e) { return null; } }).filter(Boolean);
const searchInfo = lines.find(l => l.key === 'searchInfo')?.payload;
const recordsData = lines.find(l => l.key === 'records')?.payload;
let records = [];
if (recordsData) {
records = Object.entries(recordsData).map(([idx, rec]) => ({
idx: first + parseInt(idx) - 1,
wosId: rec.colluid,
title: rec.titles?.item?.en?.[0]?.title || '',
authors: rec.names?.author?.en?.filter(Boolean).map(a => a.wos_standard).join('; ') || '',
source: rec.titles?.source?.en?.[0]?.title || '',
year: rec.pub_info?.pubyear || '',
doi: rec.doi || '',
citations: rec.citation_related?.counts?.WOSCC || 0
}));
}
return { status: 'ok', page, totalResults: searchInfo?.RecordsFound || 0, records };
}
说明
- 基于 API 的方法仅需 1 次工具调用
- 需要记住之前调用
wos-search时使用的原始搜索查询、版本和排序方式 retrieve.first是从 1 开始的记录偏移量(1 = 第 1 条记录,51 = 第 2 页,依此类推)- 每页 50 条记录,最多可访问 100,000 条记录
评论
支持 Markdown