21 — Repository-harvest spider: ingest JSON:API / paginated-JSON collections - #19
Open
MirjamOdile wants to merge 2 commits into
Open
21 — Repository-harvest spider: ingest JSON:API / paginated-JSON collections#19MirjamOdile wants to merge 2 commits into
MirjamOdile wants to merge 2 commits into
Conversation
Institutional repositories (Islandora/DSpace/Fedora) are often un-crawlable as HTML (Turnstile on every page, Crawl-delay: 120, homepage-only sitemap, broken OAI-PMH) yet expose an open machine API enumerating the full repository. New repository_database_spider walks the paginated collection endpoint and maps each record to a normal pipeline item via the REPOSITORY_SOURCE setting (dot-paths, || fallbacks, JSON:API include resolution, URL templates, standard processors). A non-empty REPOSITORY_SOURCE routes the crawl to it; HTML and sitemap spiders are untouched. 8 unit tests. docs/requests/21-jsonapi-repository-harvest.md (port of the old repo's request 11)
iRanadheer
force-pushed
the
pr/21-repository-harvest
branch
from
August 10, 2026 12:23
7ec1161 to
c4954e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken: institutional research repositories (Islandora, DSpace, Fedora fronts) are often effectively uncrawlable as HTML: a Cloudflare Turnstile puzzle on every page plus a
Crawl-delay: 120robots rule means ~20–30k documents would take weeks — while the same sites expose a fully open, puzzle-free machine API (Drupal JSON:API) that lists the complete repository. scrapai had no way to ingest a paginated JSON collection.What it does now: a new spider type walks the JSON collection endpoint page by page and maps each record into a normal pipeline item. The mapping lives entirely in the spider's JSON config (
REPOSITORY_SOURCE): field dot-paths with||fallbacks, JSON:APIincluderelationship resolution, URL templates, and the standard processor chain. Setting it routes the crawl to the new spider; every existing HTML/sitemap spider is untouched.Details
spiders/repository_spider.py(repository_database_spider): follows thenextlink until absent; records failing arequirefield (e.g. unpublished parent omitted fromincluded) are skipped, not errored.cli/crawl.py: a non-emptyREPOSITORY_SOURCEsetting routes to it, alongside the existingUSE_SITEMAProuting.DOWNLOAD_DELAYat 60, so spiders honoring aCrawl-delay: 120import with--skip-validation.docs/requests/21-jsonapi-repository-harvest.md(port of the pre-migration repo's request 11).Behavior changes
REPOSITORY_SOURCE; all HTML/sitemap routing is untouched.Verified
8 unit tests (
tests/unit/test_repository_spider.py): dot-path walker,||fallbacks, full item mapping (template + include resolution + processors), missing-include → null,requireskip, pagination follow and stop, malformed records, item-limit cutoff. The design is a port of code proven in production in the pre-migration repo.Merge note: touches
cli/crawl.py, as do PRs 17/18/19 — merging in numeric order minimizes conflicts.