Export metadata and usage statistics for records in the Copim Community on Zenodo.
The script uses a hybrid approach:
- OAI-PMH harvesting to enumerate all records in the Zenodo community.
- Zenodo REST API enrichment to retrieve record-level metadata and usage statistics.
This avoids relying solely on Zenodo search pagination while still capturing usage statistics that are not available through OAI-PMH metadata alone.
Note: The script can easily be applied to any Zenodo community by adjusting the community parameter as descibred in Usage > Step 2
The script writes a CSV with the following columns:
| Column | Description |
|---|---|
resource_type |
Zenodo resource type, such as presentation, dataset, report, or publication |
title |
Record title |
url |
Public Zenodo record URL |
doi |
Zenodo DOI |
publication_date |
Publication date normalized to YYYY-MM-DD |
views |
Zenodo usage-stat views, where available |
downloads |
Zenodo usage-stat downloads, where available |
Default output file:
zenodo_deposits_full.csv
Python 3.9 or newer is recommended.
Install dependencies:
pip install -r requirements.txtRun the default Copim export:
python zenodo_copim_oai_hybrid.pySpecify the community and OAI-PMH set explicitly:
python zenodo_copim_oai_hybrid.py --community copim --set user-copimSpecify an output filename:
python zenodo_copim_oai_hybrid.py --output copim_zenodo_deposits_full.csvUse a Zenodo token via command-line argument:
python zenodo_copim_oai_hybrid.py --token YOUR_ZENODO_TOKENOr set the token as an environment variable.
Windows Command Prompt:
set ZENODO_TOKEN=YOUR_ZENODO_TOKEN
python zenodo_copim_oai_hybrid.pyPowerShell:
$env:ZENODO_TOKEN="YOUR_ZENODO_TOKEN"
python .\zenodo_copim_oai_hybrid.pymacOS/Linux:
export ZENODO_TOKEN=YOUR_ZENODO_TOKEN
python zenodo_copim_oai_hybrid.pyA token is usually not required for public records, but it may help reduce throttling during repeated runs.
The script normalizes publication dates to YYYY-MM-DD.
| Source value | Output |
|---|---|
2024 |
2024-01-01 |
2024-05 |
2024-05-01 |
2024-05-17 |
2024-05-17 |
2024-05-17T12:34:00Z |
2024-05-17 |
When the REST record includes a more precise publication date, the script prefers the REST value and falls back to the OAI-PMH value only if needed.
The script includes retry logic for HTTP 429, 500, 502, 503, and 504 responses and sleeps between REST enrichment calls.
The default delay is:
2.2 seconds
You can adjust it:
python zenodo_copim_oai_hybrid.py --pause-seconds 5--community Zenodo community identifier. Default: copim
--set Explicit OAI-PMH set, e.g. user-copim
--metadata-prefix OAI metadata prefix. Default: oai_datacite
--output Output CSV path. Default: zenodo_deposits_full.csv
--token Optional Zenodo access token
--pause-seconds Delay between REST API requests. Default: 2.2
.
├── README.md
├── requirements.txt
├── zenodo_copim_oai_hybrid.py
├── .gitignore
└── LICENSE
OAI-PMH is used for robust community enumeration because it is designed for metadata harvesting. Zenodo usage statistics are retrieved through the REST API because they are not part of the OAI-PMH metadata formats.
Apache 2.0 License.