
cnki-export
Export paper from CNKI and push to Zotero, or save as RIS file. Use when user wants to save a paper to Zotero or export citation data.
- Installs
- 413
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/cookjohn/cnki-skills --skill cnki-export- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads cnki-export automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
CNKI Export & Zotero Integration
Export paper citation data from CNKI and push directly to Zotero, or save as RIS file.
Arguments
zotero(default) — push to Zotero desktop via local APIris— save as .ris filegb— output GB/T 7714 citation text- Optionally include a paper URL
Mode Selection
Choose the right mode based on context:
| Context | Mode | Tool calls |
|---|---|---|
| On a paper detail page | Single export (Step 1A) | 1 evaluate + 1 bash = 2 |
| On a search results page, save all/selected | Batch export (Step 1B) | 1 evaluate + 1 bash = 2 |
| Need to search then save | Use cnki-search first, then batch export | 4 total |
Always prefer batch export (1B) when multiple papers need saving. It avoids navigating to each detail page (saves ~3 calls per paper).
Steps
1A. Single export: from paper detail page
Use mcp__chrome-devtools__evaluate_script:
async () => {
const url = document.querySelector('#export-url')?.value;
const params = document.querySelector('#export-id')?.value;
const uniplatform = new URLSearchParams(window.location.search).get('uniplatform') || 'NZKPT';
if (!url || !params) return { error: 'Not on a paper detail page' };
const resp = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ filename: params, displaymode: 'GBTREFER,elearning,EndNote', uniplatform })
});
const data = await resp.json();
if (data.code !== 1) return { error: data.msg };
const result = {};
for (const item of data.data) {
result[item.mode] = item.value[0];
}
const body = document.body.innerText;
result.pageUrl = window.location.href;
result.issn = body.match(/ISSN[::]\s*(\S+)/)?.[1] || '';
result.dbcode = document.querySelector('#paramdbcode')?.value || '';
result.dbname = document.querySelector('#paramdbname')?.value || '';
result.filename = document.querySelector('#paramfilename')?.value || '';
return result;
}
1B. Batch export: from search results page (PREFERRED for multiple papers)
On any CNKI search results page, extract checkbox values and call the export API directly — no need to navigate to detail pages.
Key discovery: input.cbItem checkbox value === detail page #export-id (same encrypted ID).
Use mcp__chrome-devtools__evaluate_script:
async () => {
const API_URL = 'https://kns.cnki.net/dm8/API/GetExport';
// Get all checkbox values (= export encrypted IDs)
const checkboxes = document.querySelectorAll('.result-table-list tbody input.cbItem');
const rows = document.querySelectorAll('.result-table-list tbody tr');
if (checkboxes.length === 0) return { error: 'No results on page' };
const allPapers = [];
for (let i = 0; i < checkboxes.length; i++) {
const exportId = checkboxes[i].value;
const paperUrl = rows[i]?.querySelector('td.name a.fz14')?.href || '';
const resp = await fetch(API_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ filename: exportId, displaymode: 'GBTREFER,elearning,EndNote', uniplatform: 'NZKPT' })
});
const data = await resp.json();
if (data.code === 1) {
const result = {};
for (const item of data.data) { result[item.mode] = item.value[0]; }
result.pageUrl = paperUrl;
// Extract ISSN from ENDNOTE %@ field
const issnMatch = result.ENDNOTE?.match(/%@\s*([^\s<]+)/);
result.issn = issnMatch ? issnMatch[1] : '';
result.dbcode = 'CJFQ';
result.dbname = '';
result.filename = '';
allPapers.push(result);
}
}
return allPapers; // JSON array, directly writable to file for Python script
}
To export only specific papers (e.g. #1, #3, #5), filter by index:
// Replace the for loop condition:
const indices = [0, 2, 4]; // 0-indexed: papers #1, #3, #5
for (let i = 0; i < checkboxes.length; i++) {
if (!indices.includes(i)) continue;
// ... rest same
}
2. Push to Zotero
Save the export data (single object or JSON array) to a temp file, then run the Python script:
python "e:/cnki/.claude/skills/cnki-export/scripts/push_to_zotero.py" /tmp/papers.json
The Python script handles both single paper {} and batch [{}, {}, ...] JSON input.
- UTF-8 encoding (avoids Windows encoding issues)
- Parsing ELEARNING format into Zotero item fields
- Calling
POST http://127.0.0.1:23119/connector/saveItems - Returns: 201 = success, 500 = error, 0 = Zotero not running
3. Report result
Single:
已将论文添加到 Zotero:
标题: {title}
作者: {authors}
期刊: {journal}
GB/T 7714 引用: {gbt_citation}
Batch:
已批量添加 {count} 篇论文到 Zotero:
1. {title1} ({journal1})
2. {title2} ({journal2})
...
Export API Reference
| Parameter | Value | Source |
|---|---|---|
| API URL | https://kns.cnki.net/dm8/API/GetExport | Fixed, works from any page |
| filename | Encrypted ID | Detail page: #export-id; Results page: input.cbItem value |
| displaymode | GBTREFER,elearning,EndNote | Comma-separated modes |
| uniplatform | NZKPT | Required |
Verified selectors
| Element | Selector | Page |
|---|---|---|
| Export URL | #export-url | Detail page only |
| Export ID | #export-id | Detail page only |
| Checkbox (= export ID) | input.cbItem | Search results page |
| Result rows | .result-table-list tbody tr | Search results page |
| Title link | td.name a.fz14 | Search results page |
Zotero API Reference
POST http://127.0.0.1:23119/connector/saveItems
Content-Type: application/json
X-Zotero-Connector-API-Version: 3
Response: 201 = created, 500 = error Collection: Saves to Zotero's currently selected collection.
Query collections:
python "e:/cnki/.claude/skills/cnki-export/scripts/push_to_zotero.py" --list
Important Notes
- Windows encoding: Must use Python script, cannot pass Chinese JSON via bash/curl directly
- Zotero must be running:
localhost:23119requires Zotero desktop in background - Chinese authors: Use
namefield (single field, not split),creatorType: "author" - Batch export saves ~90% tool calls: 9 papers: 33 calls → 3 calls
- CNKI Export API:
filenamemust be encrypted ID (#export-idorinput.cbItemvalue), NOT#paramfilename
FAQ
What does the cnki-export skill do?
Export paper from CNKI and push to Zotero, or save as RIS file. Use when user wants to save a paper to Zotero or export citation data.
How do I install cnki-export?
Run npx skills add https://github.com/cookjohn/cnki-skills --skill cnki-export in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/cnki-export/ (personal) or .claude/skills/cnki-export/ (project).
Which AI agents can use cnki-export?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is cnki-export safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains cnki-export?
It is published by cookjohn in cookjohn/cnki-skills. It has 413 recorded installs.
More from cookjohn/cnki-skills
cnki-search
cookjohn/cnki-skills
Search CNKI (中国知网) for papers by keyword. Use when the user wants to find academic papers on a topic.
cnki-download
cookjohn/cnki-skills
Download a paper PDF/CAJ from CNKI. Requires user to be logged in. Use when user wants to download a specific paper.
cnki-advanced-search
cookjohn/cnki-skills
Perform advanced search on CNKI with field filters like author, title, journal, date range, source category (SCI/EI/CSSCI/北大核心). Use when user needs precise filtered search beyond simple keywords.
cnki-paper-detail
cookjohn/cnki-skills
Extract full paper details from a CNKI paper page including title, authors, affiliations, abstract, keywords, fund, classification. Use when the user needs detailed information about a specific paper.
cnki-journal-search
cookjohn/cnki-skills
Search for journals/publications on CNKI by name, ISSN, CN, or sponsor. Use when the user wants to find a specific journal or browse publications.
cnki-journal-index
cookjohn/cnki-skills
Query journal indexing/inclusion status on CNKI - check which databases include a journal (北大核心, CSSCI, CSCD, SCI, EI, etc.), get impact factors and evaluation data. Use when user asks about a journal's level, indexing, or ranking.
Popular education & science skills
teach
mattpocock/skills
Teach the user a new skill or concept, within this workspace.
scaffold-exercises
mattpocock/skills
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
paper-context-resolver
lllllllama/rigorpilot-skills
Rigor Paper Context helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacing README guidance by default.
caveman-learn
juliusbrussee/caveman
Act on a Caveman learn report - review the ranked token sinks, apply cost-lowering fixes with per-edit consent, and report what those fixes returned. Use when asked to lower an agent's token cost, what caveman has saved, to trim a heavy CLAUDE.md, or to offload re-pasted context into cavemem.
gsap-plugins
greensock/gsap-skills
Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.
teach-impeccable
pbakaus/impeccable
DEPRECATED: Use /impeccable teach instead. This command has been folded into the impeccable skill.