An ESM-only OAI-PMH 2.0 harvester for Node.js 24 and newer.
The client targets the official OAI-PMH 2.0 protocol: https://www.openarchives.org/OAI/openarchivesprotocol.html
pnpm add @nondef/ts-oai-pmh
import { OaiPmh } from "@nondef/ts-oai-pmh";
const oaiPmh = new OaiPmh({
baseUrl: "https://export.arxiv.org/oai2",
});
const identify = await oaiPmh.identify();
console.log(identify.data.repositoryName);
for await (const header of oaiPmh.listIdentifiers({
metadataPrefix: "arXiv",
from: "2020-01-01",
until: "2020-01-02",
})) {
console.log(header.identifier);
}
oai-pmh identify https://export.arxiv.org/oai2
oai-pmh get-record https://export.arxiv.org/oai2 \
--identifier oai:arXiv.org:1412.8544 \
--metadata-prefix arXiv
oai-pmh list-identifiers https://export.arxiv.org/oai2 \
--metadata-prefix arXiv \
--from 2020-01-01 \
--until 2020-01-02
List commands emit newline-delimited JSON. Single-response commands emit one formatted JSON document.
Identify, GetRecord, ListIdentifiers, ListMetadataFormats, ListRecords, and ListSets.GET by default and can use POST with application/x-www-form-urlencoded via requestMethod: "POST".OaiPmhError instances with the provider error code.YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ format.pnpm install
pnpm run format:check
pnpm run lint
pnpm run typecheck
pnpm run build
pnpm test
Default tests are fixture-based and do not call public OAI-PMH providers.