بنقرة واحدة
develop-export-translator
// Develop an export translator that converts Zotero items into a file format (JSON, XML, CSV, etc.).
// Develop an export translator that converts Zotero items into a file format (JSON, XML, CSV, etc.).
Analyze a website's API by capturing network traffic (HAR) and generating an OpenAPI spec via mitmproxy2swagger.
Create or update test cases for a Zotero translator by running it against live URLs and capturing the output.
Develop an import translator that parses a file format (JSON, XML, RIS, BibTeX, CSV, etc.) into Zotero items.
Develop a search translator that looks up items by identifier (DOI, ISBN, PMID, arXiv ID, etc.) via an external API. NOT for websites with search pages — use develop-web-translator for those.
Develop a web translator that scrapes bibliographic data from a website. This is the most common translator type.
Inspect a live web page using headless Chrome. Gets screenshots, meta tags, accessibility tree, and runs CSS selectors or JS expressions against the rendered DOM.
| name | develop-export-translator |
| description | Develop an export translator that converts Zotero items into a file format (JSON, XML, CSV, etc.). |
Fetch and read the Zotero translator documentation:
Also read index.d.ts for type definitions.
Look for existing export translators for patterns:
grep -l "doExport" *.js
node .bin/init-translator.mjs --label "<Label>" --creator "<Creator>" --type export
If the translator should also import the same format, use --type import,export and implement detectImport() and doImport() as described in the develop-import-translator skill.
Export translators have no target regex.
doExport()Loop through items with Zotero.nextItem() and write output with Zotero.write().
function doExport() {
let first = true;
Zotero.write('[\n');
let item;
while ((item = Zotero.nextItem())) {
if (!first) Zotero.write(',\n');
first = false;
Zotero.write(JSON.stringify({
title: item.title,
authors: item.creators.filter(c => c.creatorType === 'author')
.map(c => `${c.firstName} ${c.lastName}`),
date: item.date,
doi: item.DOI,
// ... map other fields ...
}, null, '\t'));
}
Zotero.write('\n]\n');
}
Key APIs:
Zotero.nextItem() — returns the next item object, or false when done.Zotero.write(string) — write to output.Zotero.getOption(name) — read export options (configured via displayOptions in the header metadata).Zotero.nextCollection() — iterate collections (requires configOptions: { getCollections: true } in header).The metadata header can include:
"configOptions": {
"async": true,
"getCollections": true
},
"displayOptions": {
"exportNotes": true,
"exportFileData": false
}
Export tests are not yet supported by the automated test runner. Test manually by exporting items from Zotero and verifying the output format.
Update lastUpdated every time you modify translator code.
node .bin/update-metadata.mjs "<Label>.js"
npm run lint -- "<Label>.js"