invenio-archive-it
Links to archived versions of InvenioRDM records in Archive-It.
Archiving is set up per community. A community names the Archive-It collection that archives its website, for example collection 22103 for https://jabberwocky.weecology.org/. A job run from the admin UI looks up that website in the collection and stores on each of the community's records which of its URLs were captured, and when. The record's landing page sidebar lists them under External resources → Archived in, the same way Zenodo shows software archived in Software Heritage.
Requires InvenioRDM v14 or later.
How it works
- A community admin sets the community's Archive-It collection
(
ia:collection). The website to look up is the community's own website (metadata.website). Example: collection ID22103for https://jabberwocky.weecology.org/. - An admin runs the Update Archive-It captures job for one community, or for every community with a collection. Each community gets one Celery task, rate-limited to 6 per minute (as Archive-It's Wayback service is shared across all users).
- The task sends one prefix query to
https://wayback.archive-it.org/{collection}/timemap/cdxfor the website, which returns every capture under it. It then matches the captures to the URLs of the records whose default community this is. Those are identifiers and related identifiers with schemeurl; Archive-It playback URLs are first reduced to the page they show. - Each record's matched captures (first and last capture per URL) are stored
in the record custom field
ia:captures. Only records whose captures changed are written. - The sidebar shows one Archive-It entry per captured URL, with the URL and
capture dates beneath it. The entry links to the Wayback calendar, e.g.
https://wayback.archive-it.org/22103/*/https://jabberwocky.weecology.org/….
If the lookup fails or Archive-It refuses it, every record keeps its previous captures.
Installation
uv add git+https://codeberg.org/front-matter/invenio-archive-it
Add the custom fields and the sidebar link to invenio.cfg. Merge them with
any namespaces, custom fields and external links you already have:
from invenio_archive_it.custom_fields import (
ARCHIVE_IT_COMMUNITY_CUSTOM_FIELDS,
ARCHIVE_IT_COMMUNITY_CUSTOM_FIELDS_UI,
ARCHIVE_IT_CUSTOM_FIELDS,
ARCHIVE_IT_NAMESPACE,
)
from invenio_archive_it.links import archived_versions_render
RDM_NAMESPACES = {**ARCHIVE_IT_NAMESPACE}
RDM_CUSTOM_FIELDS = [*ARCHIVE_IT_CUSTOM_FIELDS]
COMMUNITIES_CUSTOM_FIELDS = [*ARCHIVE_IT_COMMUNITY_CUSTOM_FIELDS]
COMMUNITIES_CUSTOM_FIELDS_UI = [ARCHIVE_IT_COMMUNITY_CUSTOM_FIELDS_UI]
APP_RDM_RECORD_LANDING_PAGE_EXTERNAL_LINKS = [
{"id": "archive_it", "render": archived_versions_render},
]
COMMUNITIES_NAMESPACES defaults to RDM_NAMESPACES, so ia covers both.
To add the collection field to an existing community settings section instead
of its own "Web archiving" section, add its entry from
ARCHIVE_IT_COMMUNITY_CUSTOM_FIELDS_UI["fields"] to that section.
Create the search mappings:
invenio rdm-records custom-fields init -f ia:captures
invenio communities custom-fields init -f ia:collection
Copy the sidebar icon into the instance's static folder with invenio collect
(invenio-cli assets build runs it too).
To run lookups, open Update Archive-It captures under Administration → Jobs and start a run. Pick a community, or leave the field empty for every community with a collection. The module adds no Celery beat schedule.
Configuration
| Setting | Default | Meaning |
|---|---|---|
ARCHIVE_IT_WAYBACK_URL |
https://wayback.archive-it.org |
Wayback service for lookups and links; validated during startup |
ARCHIVE_IT_ICON |
images/invenio_archive_it/archive-it.svg |
Sidebar icon (Archive-It logo), as a path in the static folder |
ARCHIVE_IT_TIMEOUT |
120 |
Seconds to wait for a CDX response |
ARCHIVE_IT_USER_AGENT |
invenio-archive-it (+…) |
User-Agent sent with lookups |
Important: Misconfiguring ARCHIVE_IT_WAYBACK_URL will cause sidebar links to fail
silently. The module validates the URL on startup; check the logs if configured endpoints
are unreachable.
Troubleshooting
- Lookups fail silently: Archives at Archive-It's Wayback service are behind bot
protection. Check logs for
error=blocked; verify your server can reach the CDX API. Failed lookups preserve existing captures; no data is lost. - Lookup errors in logs: Monitor warnings with
error=http_error,error=network, orerror=invalid_responseto catch misconfigurations or API changes. - Sidebar links appear broken: Ensure
ARCHIVE_IT_WAYBACK_URLis correct. The module validates it on startup; misconfiguration will be logged at warning level. - Specific community not found: Only records whose default community matches are updated. Verify the community is set correctly on records.
- Captures are written to the published record directly. This doesn't create a new version or a draft. An open draft of the record gets the same captures, so publishing it doesn't bring back old ones.
- Anything else that updates records must keep
ia:captures. An update through the records service replaces all custom fields with what it sends. - Anyone who can edit a community's settings can set its collection. To make it admin-only, restrict the field in the instance.
Development
uv sync --all-extras
uv run pytest
uv run ruff check .
uv run black --check .
License
MIT
Metadata
Release files for invenio-archive-it 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| invenio_archive_it-0.1.0.tar.gz | 24.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| invenio_archive_it-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.9 kB
Release files / invenio_archive_it-0.1.0.tar.gz
| Download URL | invenio_archive_it-0.1.0.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c09b86baf090ec9f89ec5bb760aa8029aecafba21d358a4cc44cc14bf91d160
|
|
BLAKE2b-256 checksum How to use checksums |
1a021125c89007b4ac9109b354f504b9648d11ab398f4400814463a8518588a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / invenio_archive_it-0.1.0-py3-none-any.whl
| Download URL | invenio_archive_it-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b8800231fd8410b3e9adb6c50b6acf13253532ef54da46b7aa0eac52301f490
|
|
BLAKE2b-256 checksum How to use checksums |
a309f08ff89b3bca5606cbe958923a00a13e266baf52a6e001af654f7699429a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|