Skip to content

Example scripts

Every client ships runnable scripts under packages/bibliofabric/examples/<client>/. Each script is a short, complete program that prints what it does, so that you can read a workflow and run it in one command.

Run a script

Clone the repository, sync the workspace once, and run the script from the repository root:

git clone https://github.com/utsmok/bibliofabric/
cd bibliofabric
uv sync --all-packages --all-groups
uv run python packages/bibliofabric/examples/openalex/quickstart.py

Run from the repository root, so the clients pick up credentials from a .env file in the working directory, the same way your own scripts would. Every script also runs with no credentials at all unless its table row says otherwise.

One exception: a SEMANTICSCHOLAR_API_KEY that the API rejects (HTTP 403) makes the Semantic Scholar scripts fail, so run those with the variable emptied and expect an occasional 429 from the anonymous pool:

SEMANTICSCHOLAR_API_KEY="" uv run python packages/bibliofabric/examples/semanticscholar/quickstart.py

OpenAlex

Script What it prints Credentials
quickstart.py A work's title and year, the count of a filtered query, one page of results, and a bounded author iteration None
search_and_iterate.py The most-cited works of a query, a title search hit, and the ids collected from a cursor harvest API key for the iterate part
batch_and_citations.py Batch lookup by DOI, the works citing and cited by a seed paper, and the remaining daily budget None
sync_quickstart.py The same calls as quickstart.py without asyncio None

OpenAIRE

Script What it prints Credentials
quickstart.py One product by id, a page of search matches, a few projects, and a bounded project iteration None; client id and secret optional
batch_and_fields.py Batch DOI lookups, a sparse field fetch, and one aggregation over product types None; client id and secret optional
links_and_scholix.py The graph relations of a product, the relation type vocabulary, and Scholix links None; client id and secret optional
sync_quickstart.py The same lookups as quickstart.py without asyncio None; client id and secret optional

Crossref

Script What it prints Credentials
quickstart.py A work's title and DOI, which pool served the request, cited-by counts, and a bounded cursor iteration CROSSREF_MAILTO optional
batch_and_scopes.py Batch DOI lookup with a missing-DOI check, type facets, works scoped to a funder, and the caught error for a bad id CROSSREF_MAILTO optional
sync_quickstart.py The same calls as quickstart.py without asyncio CROSSREF_MAILTO optional

ROR

Script What it prints Credentials
quickstart.py One organization by id, a filtered search page, and a bounded iteration None
sync_quickstart.py The same lookups as quickstart.py without asyncio None
affiliation_matching.py Matcher answers for free-text affiliation strings and the funder lookup by DOI None
dumps.py The latest ROR dump on Zenodo with its zip file and size, plus recent releases None

Zenodo

Script What it prints Credentials
quickstart.py A page of search matches with DOIs, one fetched record with its concept id and file count, and a bounded iteration Token optional, raises the page size cap
files.py The files of a record with sizes and types, and one small file downloaded to a temp directory None
oaipmh.py The repository name and earliest datestamp, the metadata formats, ListRecords pages, and one GetRecord record None
records_sync.py Recent publications, one fetched record with its DOI, and a dataset count Token optional

DataCite

Script What it prints Credentials
quickstart.py One DOI with type, registration client, and citation count; a page of search matches; a bounded iteration None
rest_vs_graphql.py The same DOI through REST and GraphQL side by side, and GraphQL pagination info None
dois_sync.py The REST lookups of quickstart.py through the sync client None

OpenCitations

Script What it prints Credentials
quickstart.py The incoming citations of a DOI with creation dates and timespans, the API's citation count, and its Meta metadata with identifiers None
sparql.py SPARQL result rows from the Index dataset and a Meta graph as Turtle None
sync_quickstart.py Outgoing references, one citation by OCI, and the works of one author None

DOI

Script What it prints Credentials
quickstart.py The registration agency of a DOI, its CSL JSON metadata, and its landing page URL None
formats.py One DOI as CSL JSON, BibTeX, DataCite, schema.org, and RIS None
sync_quickstart.py A handle record with its values, the resolver redirect status, and the redirect targets None

Semantic Scholar

Run these with SEMANTICSCHOLAR_API_KEY=""; see the note at the top of this page.

Script What it prints Credentials
quickstart.py A paper's title, year, and DOI; a page of search matches; a bounded iteration None; keyless pool may answer 429
batch_and_citations.py A batch lookup where unknown ids drop out, and the papers citing and cited by a seed None; keyless pool may answer 429
snippet_search.py Full-text snippets with scores, or a clear note that snippet search needs a key with snippet access Key with snippet access
sync_quickstart.py The same calls as quickstart.py without asyncio None; keyless pool may answer 429

ORCID

Script What it prints Credentials
quickstart.py A record's name, its works put codes, a search page, and a bounded id iteration Token optional; reads work without credentials
works_detail.py The works section's put codes, full works fetched in bulk, and one single fetch Token optional
sync_quickstart.py Record, person details, and an expanded search without asyncio Token optional

Europe PMC

Script What it prints Credentials
quickstart.py A search hit list, one article record, and a bounded iteration None
article_citations.py A seed article with its cited-by count, the papers citing it, and its references None
fulltext_sync.py The JATS full text of an open access article fetched with the sync client, and the expected miss for a non-OA article None

Wikidata

Script What it prints Credentials
quickstart.py One entity with label and description, a search page, a bounded iteration, and a SPARQL result None
external_ids.py The Wikidata item behind a DOI or an ORCID iD and the claims that carry them None
entity_sync.py Entity lookup, a batch lookup with a rejected id, and one ASK query None

DOAJ

Script What it prints Credentials
quickstart.py A journal by ISSN with its ISSNs, an article by DOI, and a bounded search None
sync_quickstart.py The same journal and article lookups without asyncio None
journal_check.py For each ISSN on its list, whether DOAJ indexes it and how many articles it holds None
download_journal_csv.py Without --csv, a usage note; with --csv PATH, the first rows of the downloaded journal export None

ISSN Portal

Script What it prints Credentials
quickstart.py An ISSN record with its ISSN-L, a resolved cluster, a Portal search, and a bounded iteration None
issn_l_resolution.py ISSN-L clusters resolved online, or from the downloaded table with --table None
ltwa_abbreviations.py For each word in a list, the closest LTWA stem and its ISO 4 abbreviation None
sync_quickstart.py The record and cluster lookups without asyncio None

arXiv

Script What it prints Credentials
quickstart.py One paper with id, version, and PDF URL; a page of search results; a bounded iteration None; arXiv paces requests at one per three seconds
query_builder.py A composed query string, a 30-day submission count, the newest match, and five collected records None
arxiv_sync.py Batch lookups by id in three spellings and a category count, through the sync client None

bioRxiv and medRxiv

Script What it prints Credentials
quickstart.py Every version of one preprint, a page of medRxiv posts in a date window, and a bounded harvest None
published_links.py The published-article DOI for preprints, and the preprints published over a window None
rxiv_sync.py Version lists by DOI and published-article links without asyncio None

ClinicalTrials.gov

Script What it prints Credentials
quickstart.py One study by NCT id, a structured search page, and the API and data version None
stats_and_harvest.py Corpus size stats, field value stats, a bounded sync harvest, and a CSV download None

INSPIRE-HEP

Script What it prints Credentials
quickstart.py One literature record by recid, a sorted search page, a BibTeX citation, a batch lookup, an author by ORCID iD, and a bounded experiments iteration None
citations.py The citing records of one literature record, a bounded citation iteration, and three citation formats None

HAL

Script What it prints Credentials
quickstart.py One document record by HAL identifier, a page of journal-article search results with typed filters, and a bounded cursor iteration None
referentials.py A structure by docid, journal search results, the document type table with subtypes, and a portal-scoped search None
sync_quickstart.py A DOI lookup, a HAL identifier lookup, and a collected record without asyncio None

DBLP

Script What it prints Credentials
quickstart.py Publication, person, and venue search plus one full record page None
sync_quickstart.py The same calls without asyncio None

GLEIF

Script What it prints Credentials
quickstart.py One LEI record by id, a filtered search, the ultimate parent of one record, the children of another, and a bounded iteration None
sync_quickstart.py One record, a search page, and a CSV export through the sync client None

Dryad

Script What it prints Credentials
quickstart.py A dataset search, one dataset, its versions, and the files of the newest version None; DRYAD_CLIENT_ID and DRYAD_CLIENT_SECRET unlock the download routes
reports_and_files.py The report index, one report CSV, and files fetched by digest None

Figshare

Script What it prints Credentials
quickstart.py An article search, one article record, the newest articles, and collections None
files.py The files of one article with their checksums and one small download None

NIH RePORTER

Script What it prints Credentials
quickstart.py A filtered project page, a count with a second criterion, linked publications, and a batch by application id None
projects_sync.py The same searches through the sync client, plus a bounded iterate() harvest None

Dataverse

Script What it prints Credentials
quickstart.py A dataset search with entity ids, one dataset fetched by persistent id, its typed metadata fields, the server name, and a metric count None
files.py The file listing of one dataset, and the smallest file under 1 MB streamed into a temporary directory None

Software Heritage

Script What it prints Credentials
quickstart.py The latest visit of an origin, its snapshot branches, and a page of origin search results None
sync_quickstart.py A bounded origin iteration and SWHID existence checks through the sync client None

ChemRxiv

Script What it prints Credentials
quickstart.py A preprint search, the same item by id and by DOI, the category list, and a bounded iteration, against a live Engage instance None
sync_quickstart.py A search page, the category count, and the API version through the sync client None

Open Policy Finder

Script What it prints Credentials
quickstart.py One journal by ISSN, a page of publisher-policy search results with filters and sort, a repository search, and a funder count OPENPOLICYFINDER_API_KEY required
ids_walk.py A page of the CSV id directory, a bounded id walk, and one full repository record OPENPOLICYFINDER_API_KEY required

OSF Preprints

Script What it prints Credentials
quickstart.py One preprint with DOI and landing page, its osfstorage files, a filtered search page, a styled citation, the provider list, and bounded iteration None
preprints_sync.py Versions, subjects, licenses, a provider count, and a provider preprint page through the sync client None

Gateway to Research

Script What it prints Credentials
quickstart.py A project search, one project's grant reference, fund value, and people None
project_outcomes.py One publication with its index size, the project it links back to, that project's publication count, and a page of the merged outcomes stream None

CORE

Script What it prints Credentials
quickstart.py A works search page, one work with its stats, and the count of a second query CORE_API_KEY optional
providers_and_discovery.py Data providers, a POST search page, a discovery answer, a recommendation, and one raw output record CORE_API_KEY optional

RAiD

Script What it prints Credentials
quickstart.py A keyword search page, an organisation-filtered count, one RAiD by handle, a prefix listing, and the service point directory None
sync_quickstart.py A first sync with sources.syncFrom, then the updatedSince diff of the same window None
Script What it prints Credentials
quickstart.py One award by number, a filtered search page with the display-capped total, and facet buckets for the same query None
export_years.py The export file list, the smallest year zip downloaded, and its first award records None

Mir@bel

Script What it prints Credentials
quickstart.py A title by ISSN, the journal history behind it, a publisher by id, online accesses for an ISSN, and the taxonomy size None
sync_quickstart.py The same title and journal lookups plus one search window, without asyncio None

MeSH

Script What it prints Credentials
quickstart.py Descriptor label lookups, allowed qualifiers, one record, and a SPARQL query None
sync_quickstart.py The same lookups without asyncio, plus a details overview and a SPARQL query in CSV None

Lobid-GND

Script What it prints Credentials
quickstart.py One GND record, a search with an entity type filter, a bounded iteration, suggestions, and a small JSONL bulk download None
reconcile_names.py A list of names matched against the GND reconciliation service None

Identifiers.org

Script What it prints Credentials
quickstart.py A resolved curie with its best provider, a reverse resolution, a namespace by prefix, the resources of one namespace, usage counts, and the snapshot namespace count None
sync_quickstart.py The same calls without asyncio None

CodeMeta and CFF

Script What it prints Credentials
quickstart.py A summary of a codemeta.json and a CITATION.cff, from the bundled fixtures or from a directory you pass None, the parsers run offline

HK-dir kanalregister

Script What it prints Credentials
quickstart.py A journal by table id with its level, the publisher list, a title search, and the per-year levels of one journal None
snapshot.py One line per table: row and byte counts of all four downloaded bulk-csv tables None

Signposting

Script What it prints Credentials
quickstart.py The signposting of a Dataverse dataset DOI and a Zenodo record landing page, with the link set document None
sync_quickstart.py The same for a Zenodo record with the sync client None

JUFO

Script What it prints Credentials
quickstart.py One channel by id with its level history, a name search page, book publishers by ISBN prefix, and a conference by abbreviation None
sync_quickstart.py The same lookups with JufoSyncClient None
read_dump.py Channel counts by type and level, read offline from a downloaded dump zip you pass as an argument None

PubMed

Script What it prints Credentials
quickstart.py A search hit list, one document summary, one full record with authors and abstract, the PMC links of the record, and a bounded full-record harvest None; PUBMED_API_KEY and PUBMED_EMAIL optional
records_sync.py A record count, the first collected records of a query with pmid, DOI, and first author, and the PubMed build info and database list None; PUBMED_EMAIL optional

re3data

Script What it prints Credentials
quickstart.py A filtered search (country and repository type) and one full repository description with subjects and APIs None
sync_quickstart.py A free-text search and one description through the sync client None

VIAF

Script What it prints Credentials
quickstart.py One cluster by id with a heading, a CQL search page, a BriefVIAF search total, and AutoSuggest hits None
sync_quickstart.py The same cluster and AutoSuggest lookups with a count query, without asyncio None

NASA ADS

Script What it prints Credentials
quickstart.py One record by bibcode, the count of a filtered query, one sorted page, and a bounded cursor iteration NASADS_API_TOKEN
export_records.py A bigquery over four bibcodes, the page as BibTeX, and the tokens of a sample query NASADS_API_TOKEN

BASE

Script What it prints Credentials
quickstart.py A fielded search page, one record by dcdocid, the count of a query, and a few iterated hits IP whitelist or BASE_API_KEY
repositories.py The repositories of the ceu collection and the profile of the first one IP whitelist or BASE_API_KEY