fetchpdf 0.1.7__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fetchpdf-0.1.7/fetchpdf.egg-info → fetchpdf-0.1.9}/PKG-INFO +31 -15
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/README.md +30 -14
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/__init__.py +1 -1
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/fetchpdf.py +6 -1
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/get_cookies.py +3 -1
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/institutional.py +66 -5
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_atypon.py +12 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_graph.py +368 -55
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_index.py +63 -8
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_pmc.py +18 -9
- fetchpdf-0.1.9/fetchpdf/retrieval/supplement_repos.py +459 -0
- fetchpdf-0.1.9/fetchpdf/retrieval/supplement_wayback.py +178 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplementary.py +21 -3
- {fetchpdf-0.1.7 → fetchpdf-0.1.9/fetchpdf.egg-info}/PKG-INFO +31 -15
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf.egg-info/SOURCES.txt +4 -0
- fetchpdf-0.1.9/tests/test_datacite_reverse_paging.py +300 -0
- fetchpdf-0.1.9/tests/test_datacite_supplement_identity.py +232 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_institutional.py +37 -0
- fetchpdf-0.1.9/tests/test_supplement_repos.py +419 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_supplementary.py +223 -2
- fetchpdf-0.1.7/tests/test_datacite_supplement_identity.py +0 -30
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/LICENSE +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/MANIFEST.in +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/__main__.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/_env.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/_http.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/fetch_abstract_from_doi.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/fetch_metadata_from_doi.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/__init__.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/_util.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/artifact.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/backends/__init__.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/backends/claude_cli.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/backends/openrouter.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/blocked.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/byline.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/cache.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/chunk.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/classify.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/context.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/corresponding.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/engine.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/extract_images.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/figures.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/fulltext_scan.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/goals.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/http.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/identifiers.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/ladder.json +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/linked_artifacts.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/llm_adjudicate.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/llm_agent_retrieval.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/normalize.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/pdf_identity.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/pdf_text.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/provenance.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/pubpeer.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/ratelimit.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/references.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/repository_waf.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/request_drafts.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/resolve.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/__init__.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/arxiv.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/core_text.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/crossref_tdm.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/epmc.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/epmc_repo.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/landing.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/legacy_pdf.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/pmc.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/pmc_html.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/preprint.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/publisher_html.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/sources/supplements.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_dspace.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_jci.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/supplement_publishers.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/tiers.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/to_html.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/to_markdown.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/validate.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf/retrieval/verify.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf.egg-info/dependency_links.txt +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf.egg-info/entry_points.txt +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf.egg-info/requires.txt +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/fetchpdf.egg-info/top_level.txt +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/pyproject.toml +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/requirements.txt +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/setup.cfg +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_agent_backends.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_blocked.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_cookie_offer.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_corresponding.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_dspace.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_elsevier_routing.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_entrypoints.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_epmc_repo.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_extract_images.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_figures.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_folder_encoding.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_fulltext_scan.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_get_cookies.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_jci_supplements.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_json_output.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_landing_candidates.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_landing_page_detection.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_last_resort_reachability.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_linked_artifacts.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_llm_adjudicate.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_llm_agent_retrieval.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_normalize_cells.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pdf_identity.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pdf_trailer.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pmc_page.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_polite_ua.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pubmed_identity.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pubpeer.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pull_for_record_call_sites.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_pure.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_request_drafts.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_retrieval.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_review_fixes.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_scan_record.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_screening_conversion.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_serpapi_scholar.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_short_conference_xml.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_supplement_asset_identity.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_to_html.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_xml_fallback_extras.py +0 -0
- {fetchpdf-0.1.7 → fetchpdf-0.1.9}/tests/test_xml_last.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fetchpdf
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: A comprehensive tool to download PDFs from DOIs using multiple sources
|
|
5
5
|
Author-email: Dan Elton <delton17@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -578,7 +578,8 @@ suppressed when the answer is already known: any flag that turns the
|
|
|
578
578
|
supplementary pass on (`--pull-supplementary`, `--refresh-supplementary`,
|
|
579
579
|
`--download-data-artifacts`, `--fetch-everything`, `--llm-agent-retrieval`), an
|
|
580
580
|
explicit `--on-existing skip` or `supplement`, `--abstract-only`, or the
|
|
581
|
-
goal-aware flags (`--get-xml-or-html-and-pdf`, `--
|
|
581
|
+
goal-aware flags (`--get-xml-or-html-and-pdf`, `--get-xml-and-pdf`, `--get-xml-and-html-and-pdf`,
|
|
582
|
+
`--upgrade-existing` on the tiered path),
|
|
582
583
|
which do not skip records at all. Single-identifier runs never ask.
|
|
583
584
|
|
|
584
585
|
What is *not* remembered between runs: failures. `failed_dois.csv` is a report,
|
|
@@ -676,13 +677,14 @@ Twenty routes, tried in a fixed order so the numbering is reproducible:
|
|
|
676
677
|
| bioRxiv / medRxiv | `10.1101` |
|
|
677
678
|
| APA supplemental | `10.1037` |
|
|
678
679
|
| Figshare / Zenodo / OSF | repository DOIs, and datasets reached through link services |
|
|
679
|
-
| DataCite reverse relations | any DOI — finds deposits whose own DataCite record
|
|
680
|
+
| DataCite reverse relations | any DOI — finds deposits whose own DataCite record claims the article through a supplement relation (`IsSupplementTo`, `IsPartOf`, `IsDescribedBy`, `IsDocumentedBy`, or the inverse `IsSupplementedBy` / `HasPart`); deposits that cite it, derive from it (`IsDerivedFrom`) or relate to it any other way are dropped unless their title is a "Data from: <article title>"-style match or, for Dryad, Dryad's own API names the article as the dataset's primary article. Reads up to 500 records and routes up to 100 deposits, one per deposit however many versions are registered. Figshare "journal contribution" items (publisher SI documents, typed `JournalArticle` in DataCite) are kept when they say `IsSupplementTo` the article |
|
|
680
681
|
| Crossref component DOIs | publishers that register components |
|
|
681
|
-
| JATS-declared URLs | absolute URLs the JATS itself declares (e.g. LWW permalinks) — recovery of last resort |
|
|
682
|
+
| JATS-declared URLs | absolute URLs the JATS itself declares (e.g. LWW permalinks, publisher Source Data links) — recovery of last resort. Read from the PMC copy or, with no PMCID, from a publisher `{stem}.xml` saved beside the record (e.g. by `--get-xml-and-pdf`); TEI and non-JATS XML are ignored |
|
|
682
683
|
| OpenAIRE ScholeXplorer | any DOI — Scholix publication→dataset/software links |
|
|
683
684
|
| Europe PMC datalinks | any PMID — text-mined accessions and data citations |
|
|
684
685
|
| Full-text scan | deposits the paper names in its own prose — only under `--download-data-artifacts` |
|
|
685
686
|
| Atypon publisher SI | PNAS, Science, Annual Reviews, SAGE, T&F — only when Europe PMC withholds the SI or the record has no PMCID; drives a headed browser, so it needs Playwright, Chromium and a display (or Xvfb) |
|
|
687
|
+
| Internet Archive (Wayback Machine) | Last-ditch fallback for publisher-hosted SI (Atypon hosts incl. SAGE, INFORMS, AOM, PNAS; Elsevier `ars.els-cdn.com` mmc files; supp.apa.org): asks the Archive's open CDX index for captures under the article's supplement URLs and downloads the archived copy. Runs only when no publisher-supplement provider listed anything; an Archive outage is reported as `blocked`, not as "none found" |
|
|
686
688
|
| LLM retrieval agent | only under [`--fetch-everything`](#--fetch-everything-the-second-layer) or `--llm-agent-retrieval` |
|
|
687
689
|
| JCI | `10.1172/jci…` |
|
|
688
690
|
|
|
@@ -760,7 +762,7 @@ citation-grade link is promoted to `owned` only when the deposit's DataCite
|
|
|
760
762
|
record names the article. Under `--download-data-artifacts`, `related` links are
|
|
761
763
|
downloaded too, unless the deposit's own metadata says it belongs to a
|
|
762
764
|
*different* article (`--download-related-unverified` drops even that check).
|
|
763
|
-
Routed deposits in
|
|
765
|
+
Routed deposits in any repository in the download table below go to those
|
|
764
766
|
enumerators and land under `{stem}_data_artifacts/<deposit>/` with their
|
|
765
767
|
original filenames (`routed_to_download: true` in the sidecar); they still get
|
|
766
768
|
an entry in the supplementary manifest. The same deposit named by several link
|
|
@@ -808,19 +810,28 @@ Download — repositories with file enumerators (links that pass the routing rul
|
|
|
808
810
|
|
|
809
811
|
| Repository | Routed on | Notes |
|
|
810
812
|
|---|---|---|
|
|
811
|
-
| figshare | `10.6084` / "figshare" | declared size + md5 before transfer |
|
|
813
|
+
| figshare | `10.6084` / "figshare" | declared size + md5 before transfer; collections (`figshare.c.N`) are listed item by item |
|
|
814
|
+
| figshare portals | GSA `10.25386`/`10.25387`, ASHA `10.23641`, Sheffield `10.15131`, Loughborough `10.17028`, UCL `10.5522/04`, and any deposit whose DataCite landing page is on `*.figshare.com` | the item must name the deposit DOI back before its files are taken |
|
|
812
815
|
| Zenodo | `10.5281` / "zenodo" | restricted records skipped |
|
|
813
816
|
| OSF | `10.17605` / "osf.io" | walks folder trees (depth/node caps) |
|
|
814
817
|
| Dryad | `10.5061` / "dryad" | declared size + sha-256, paginated |
|
|
815
818
|
| Harvard Dataverse | `10.7910/DVN` | declared md5; restricted files skipped |
|
|
819
|
+
| Mendeley Data | `10.17632` | declared size + sha-256; older versions listed folder by folder |
|
|
820
|
+
| PANGAEA | `10.1594/PANGAEA.N` | one file per DOI (table, binary, or a zip for a series); no declared size or checksum; datasets under moratorium skipped |
|
|
821
|
+
| 4TU.ResearchData | `10.4121` | declared size + md5; embargoed and metadata-only records skipped; collections supported |
|
|
822
|
+
| Science Data Bank | `10.57760` / `10.11922` `sciencedb.` | declared size + md5; walks folders |
|
|
816
823
|
| BioStudies | — | content arrives via the Europe PMC supplementary bundle instead, never fetched twice |
|
|
817
824
|
|
|
818
|
-
Not
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
825
|
+
Not downloadable (recorded, left to the operator):
|
|
826
|
+
SAGE's figshare (`10.25384` — the public figshare API does not serve it; SAGE
|
|
827
|
+
supplements come through the Atypon and Internet Archive routes instead),
|
|
828
|
+
ICPSR / openICPSR (`10.3886` — login and terms of use), non-Harvard Dataverse
|
|
829
|
+
installations, subject databases (GEO, SRA, PDB, UniProt — accession records,
|
|
830
|
+
not file bundles), GitLab repositories, and the institutional-repository long
|
|
831
|
+
tail. Dryad lists files freely but its download API currently answers HTTP 401
|
|
832
|
+
without a bearer token, so Dryad files are reported as `blocked`.
|
|
833
|
+
Adding an enumerator is the same small pattern as the ones in
|
|
834
|
+
`fetchpdf/retrieval/supplement_repos.py`.
|
|
824
835
|
|
|
825
836
|
## `--fetch-everything`: the second layer
|
|
826
837
|
|
|
@@ -1134,6 +1145,11 @@ the DOI link, and the PDF the landing page declares is fetched: **AACR**
|
|
|
1134
1145
|
(`10.1182`), **Company of Biologists** (`10.1242`), **ERS** (`10.1183`),
|
|
1135
1146
|
**BMJ** (`10.1136`), **Bioscientifica** (`10.1530`) and **LWW** (`10.1097`).
|
|
1136
1147
|
|
|
1148
|
+
**IEEE Xplore** (`10.1109`) keys articles by a number the DOI does not
|
|
1149
|
+
contain, so the route reads it from the DOI link's redirect and fetches
|
|
1150
|
+
`stampPDF/getPDF.jsp` with your cookies. Sign in once (or just open any IEEE
|
|
1151
|
+
PDF from a network your library covers) and the session cookies carry over.
|
|
1152
|
+
|
|
1137
1153
|
Several of these are open access but sit behind a Cloudflare bot check that a
|
|
1138
1154
|
plain download cannot pass. Opening any article on the site once in your
|
|
1139
1155
|
everyday browser earns the clearance cookie, and the next run reuses it.
|
|
@@ -1229,9 +1245,9 @@ refusal, not a bare failure:
|
|
|
1229
1245
|
| `path` | str \| null | Absolute path to the artifact, or null. |
|
|
1230
1246
|
| `format` | str | From the artifact actually written: `pdf`, `xml`, `html`, `latex`, `landing`, `suppl`, `abstract`, `text`, `other`. **A successful record is not necessarily a PDF** — with the default XML fallback a record can succeed as `xml`. |
|
|
1231
1247
|
| `source` | str \| null | The route that produced it (`unpaywall`, `core`, `osf`, …), `existing` for a skip, `structured_fallback` when no PDF was available and structured full text was saved instead. |
|
|
1232
|
-
| `identity` | str \| null | The verdict on the PDF **fetched in this run and reported in `path`**: `verified`, or a refusal — `wrong_article`, `truncated`, `unreadable`, `no_reference`, `no_engine`. Null when nothing was judged: an XML artifact, a file already on disk, or any run under the tiered flags (`--prioritize-xml`, `--get-xml-or-html-and-pdf`, `--xml-only`, `--xml-html-only`), where the engine validates per tier instead. A success with a non-`verified` identity is a PDF that was kept rather than deleted because the verdict could not be trusted — see [the identity check](#format-prioritized-retrieval) — not one that passed. |
|
|
1248
|
+
| `identity` | str \| null | The verdict on the PDF **fetched in this run and reported in `path`**: `verified`, or a refusal — `wrong_article`, `truncated`, `unreadable`, `no_reference`, `no_engine`. Null when nothing was judged: an XML artifact, a file already on disk, or any run under the tiered flags (`--prioritize-xml`, `--get-xml-or-html-and-pdf`, `--get-xml-and-pdf`, `--get-xml-and-html-and-pdf`, `--xml-only`, `--xml-html-only`), where the engine validates per tier instead. A success with a non-`verified` identity is a PDF that was kept rather than deleted because the verdict could not be trusted — see [the identity check](#format-prioritized-retrieval) — not one that passed. |
|
|
1233
1249
|
| `reasons` | list[str] | Why a record failed, or why a kept PDF could not be verified. Empty on a verified success. |
|
|
1234
|
-
| `paths` | list[str] | The other artifacts a tiered run wrote (`--get-xml-or-html-and-pdf`), empty otherwise. `path` is not repeated here. |
|
|
1250
|
+
| `paths` | list[str] | The other artifacts a tiered run wrote (`--get-xml-or-html-and-pdf` and its `--get-xml-and-pdf` / `--get-xml-and-html-and-pdf` variants), empty otherwise. `path` is not repeated here. |
|
|
1235
1251
|
| `supplementary` | object | Only with `--pull-supplementary` (or a flag that implies it): `status` (`ok`, `none_found`, `partial`, `incomplete`, `error`, `skipped`), `written`, `skipped`, `manifest` (absolute path or null), `missing_declared` (files the article declares that were not obtained) and `blocked_urls` (refused to this client; open them in a browser). |
|
|
1236
1252
|
| `figures` | object | Only with `--pull-figures`: `status`, `written`, `failed`, `refusal` and `manifest`. |
|
|
1237
1253
|
| `images` | object | Only with `--extract-images`: `status`, `written` and `manifest`. |
|
|
@@ -1469,7 +1485,7 @@ These run first when the DOI matches (by prefix, or by the name appearing anywhe
|
|
|
1469
1485
|
records whose key is entitled to the XML but not the PDF, and covers
|
|
1470
1486
|
ScienceDirect DOIs outside `10.1016/*`. It does not repeat a PDF request the
|
|
1471
1487
|
early step already made. The XML half is skipped with `--no-xml-fallback`.
|
|
1472
|
-
- With `--prioritize-xml` / `--xml-only` / `--get-xml
|
|
1488
|
+
- With `--prioritize-xml` / `--xml-only` / any `--get-xml-*-and-pdf` flag the tiered
|
|
1473
1489
|
ladder asks the same endpoint itself (`elsevier_tdm` at T1, `elsevier_pdf`
|
|
1474
1490
|
at T5, ahead of the legacy chain).
|
|
1475
1491
|
- **Off campus?** Entitlement is decided by your IP unless you also set
|
|
@@ -538,7 +538,8 @@ suppressed when the answer is already known: any flag that turns the
|
|
|
538
538
|
supplementary pass on (`--pull-supplementary`, `--refresh-supplementary`,
|
|
539
539
|
`--download-data-artifacts`, `--fetch-everything`, `--llm-agent-retrieval`), an
|
|
540
540
|
explicit `--on-existing skip` or `supplement`, `--abstract-only`, or the
|
|
541
|
-
goal-aware flags (`--get-xml-or-html-and-pdf`, `--
|
|
541
|
+
goal-aware flags (`--get-xml-or-html-and-pdf`, `--get-xml-and-pdf`, `--get-xml-and-html-and-pdf`,
|
|
542
|
+
`--upgrade-existing` on the tiered path),
|
|
542
543
|
which do not skip records at all. Single-identifier runs never ask.
|
|
543
544
|
|
|
544
545
|
What is *not* remembered between runs: failures. `failed_dois.csv` is a report,
|
|
@@ -636,13 +637,14 @@ Twenty routes, tried in a fixed order so the numbering is reproducible:
|
|
|
636
637
|
| bioRxiv / medRxiv | `10.1101` |
|
|
637
638
|
| APA supplemental | `10.1037` |
|
|
638
639
|
| Figshare / Zenodo / OSF | repository DOIs, and datasets reached through link services |
|
|
639
|
-
| DataCite reverse relations | any DOI — finds deposits whose own DataCite record
|
|
640
|
+
| DataCite reverse relations | any DOI — finds deposits whose own DataCite record claims the article through a supplement relation (`IsSupplementTo`, `IsPartOf`, `IsDescribedBy`, `IsDocumentedBy`, or the inverse `IsSupplementedBy` / `HasPart`); deposits that cite it, derive from it (`IsDerivedFrom`) or relate to it any other way are dropped unless their title is a "Data from: <article title>"-style match or, for Dryad, Dryad's own API names the article as the dataset's primary article. Reads up to 500 records and routes up to 100 deposits, one per deposit however many versions are registered. Figshare "journal contribution" items (publisher SI documents, typed `JournalArticle` in DataCite) are kept when they say `IsSupplementTo` the article |
|
|
640
641
|
| Crossref component DOIs | publishers that register components |
|
|
641
|
-
| JATS-declared URLs | absolute URLs the JATS itself declares (e.g. LWW permalinks) — recovery of last resort |
|
|
642
|
+
| JATS-declared URLs | absolute URLs the JATS itself declares (e.g. LWW permalinks, publisher Source Data links) — recovery of last resort. Read from the PMC copy or, with no PMCID, from a publisher `{stem}.xml` saved beside the record (e.g. by `--get-xml-and-pdf`); TEI and non-JATS XML are ignored |
|
|
642
643
|
| OpenAIRE ScholeXplorer | any DOI — Scholix publication→dataset/software links |
|
|
643
644
|
| Europe PMC datalinks | any PMID — text-mined accessions and data citations |
|
|
644
645
|
| Full-text scan | deposits the paper names in its own prose — only under `--download-data-artifacts` |
|
|
645
646
|
| Atypon publisher SI | PNAS, Science, Annual Reviews, SAGE, T&F — only when Europe PMC withholds the SI or the record has no PMCID; drives a headed browser, so it needs Playwright, Chromium and a display (or Xvfb) |
|
|
647
|
+
| Internet Archive (Wayback Machine) | Last-ditch fallback for publisher-hosted SI (Atypon hosts incl. SAGE, INFORMS, AOM, PNAS; Elsevier `ars.els-cdn.com` mmc files; supp.apa.org): asks the Archive's open CDX index for captures under the article's supplement URLs and downloads the archived copy. Runs only when no publisher-supplement provider listed anything; an Archive outage is reported as `blocked`, not as "none found" |
|
|
646
648
|
| LLM retrieval agent | only under [`--fetch-everything`](#--fetch-everything-the-second-layer) or `--llm-agent-retrieval` |
|
|
647
649
|
| JCI | `10.1172/jci…` |
|
|
648
650
|
|
|
@@ -720,7 +722,7 @@ citation-grade link is promoted to `owned` only when the deposit's DataCite
|
|
|
720
722
|
record names the article. Under `--download-data-artifacts`, `related` links are
|
|
721
723
|
downloaded too, unless the deposit's own metadata says it belongs to a
|
|
722
724
|
*different* article (`--download-related-unverified` drops even that check).
|
|
723
|
-
Routed deposits in
|
|
725
|
+
Routed deposits in any repository in the download table below go to those
|
|
724
726
|
enumerators and land under `{stem}_data_artifacts/<deposit>/` with their
|
|
725
727
|
original filenames (`routed_to_download: true` in the sidecar); they still get
|
|
726
728
|
an entry in the supplementary manifest. The same deposit named by several link
|
|
@@ -768,19 +770,28 @@ Download — repositories with file enumerators (links that pass the routing rul
|
|
|
768
770
|
|
|
769
771
|
| Repository | Routed on | Notes |
|
|
770
772
|
|---|---|---|
|
|
771
|
-
| figshare | `10.6084` / "figshare" | declared size + md5 before transfer |
|
|
773
|
+
| figshare | `10.6084` / "figshare" | declared size + md5 before transfer; collections (`figshare.c.N`) are listed item by item |
|
|
774
|
+
| figshare portals | GSA `10.25386`/`10.25387`, ASHA `10.23641`, Sheffield `10.15131`, Loughborough `10.17028`, UCL `10.5522/04`, and any deposit whose DataCite landing page is on `*.figshare.com` | the item must name the deposit DOI back before its files are taken |
|
|
772
775
|
| Zenodo | `10.5281` / "zenodo" | restricted records skipped |
|
|
773
776
|
| OSF | `10.17605` / "osf.io" | walks folder trees (depth/node caps) |
|
|
774
777
|
| Dryad | `10.5061` / "dryad" | declared size + sha-256, paginated |
|
|
775
778
|
| Harvard Dataverse | `10.7910/DVN` | declared md5; restricted files skipped |
|
|
779
|
+
| Mendeley Data | `10.17632` | declared size + sha-256; older versions listed folder by folder |
|
|
780
|
+
| PANGAEA | `10.1594/PANGAEA.N` | one file per DOI (table, binary, or a zip for a series); no declared size or checksum; datasets under moratorium skipped |
|
|
781
|
+
| 4TU.ResearchData | `10.4121` | declared size + md5; embargoed and metadata-only records skipped; collections supported |
|
|
782
|
+
| Science Data Bank | `10.57760` / `10.11922` `sciencedb.` | declared size + md5; walks folders |
|
|
776
783
|
| BioStudies | — | content arrives via the Europe PMC supplementary bundle instead, never fetched twice |
|
|
777
784
|
|
|
778
|
-
Not
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
785
|
+
Not downloadable (recorded, left to the operator):
|
|
786
|
+
SAGE's figshare (`10.25384` — the public figshare API does not serve it; SAGE
|
|
787
|
+
supplements come through the Atypon and Internet Archive routes instead),
|
|
788
|
+
ICPSR / openICPSR (`10.3886` — login and terms of use), non-Harvard Dataverse
|
|
789
|
+
installations, subject databases (GEO, SRA, PDB, UniProt — accession records,
|
|
790
|
+
not file bundles), GitLab repositories, and the institutional-repository long
|
|
791
|
+
tail. Dryad lists files freely but its download API currently answers HTTP 401
|
|
792
|
+
without a bearer token, so Dryad files are reported as `blocked`.
|
|
793
|
+
Adding an enumerator is the same small pattern as the ones in
|
|
794
|
+
`fetchpdf/retrieval/supplement_repos.py`.
|
|
784
795
|
|
|
785
796
|
## `--fetch-everything`: the second layer
|
|
786
797
|
|
|
@@ -1094,6 +1105,11 @@ the DOI link, and the PDF the landing page declares is fetched: **AACR**
|
|
|
1094
1105
|
(`10.1182`), **Company of Biologists** (`10.1242`), **ERS** (`10.1183`),
|
|
1095
1106
|
**BMJ** (`10.1136`), **Bioscientifica** (`10.1530`) and **LWW** (`10.1097`).
|
|
1096
1107
|
|
|
1108
|
+
**IEEE Xplore** (`10.1109`) keys articles by a number the DOI does not
|
|
1109
|
+
contain, so the route reads it from the DOI link's redirect and fetches
|
|
1110
|
+
`stampPDF/getPDF.jsp` with your cookies. Sign in once (or just open any IEEE
|
|
1111
|
+
PDF from a network your library covers) and the session cookies carry over.
|
|
1112
|
+
|
|
1097
1113
|
Several of these are open access but sit behind a Cloudflare bot check that a
|
|
1098
1114
|
plain download cannot pass. Opening any article on the site once in your
|
|
1099
1115
|
everyday browser earns the clearance cookie, and the next run reuses it.
|
|
@@ -1189,9 +1205,9 @@ refusal, not a bare failure:
|
|
|
1189
1205
|
| `path` | str \| null | Absolute path to the artifact, or null. |
|
|
1190
1206
|
| `format` | str | From the artifact actually written: `pdf`, `xml`, `html`, `latex`, `landing`, `suppl`, `abstract`, `text`, `other`. **A successful record is not necessarily a PDF** — with the default XML fallback a record can succeed as `xml`. |
|
|
1191
1207
|
| `source` | str \| null | The route that produced it (`unpaywall`, `core`, `osf`, …), `existing` for a skip, `structured_fallback` when no PDF was available and structured full text was saved instead. |
|
|
1192
|
-
| `identity` | str \| null | The verdict on the PDF **fetched in this run and reported in `path`**: `verified`, or a refusal — `wrong_article`, `truncated`, `unreadable`, `no_reference`, `no_engine`. Null when nothing was judged: an XML artifact, a file already on disk, or any run under the tiered flags (`--prioritize-xml`, `--get-xml-or-html-and-pdf`, `--xml-only`, `--xml-html-only`), where the engine validates per tier instead. A success with a non-`verified` identity is a PDF that was kept rather than deleted because the verdict could not be trusted — see [the identity check](#format-prioritized-retrieval) — not one that passed. |
|
|
1208
|
+
| `identity` | str \| null | The verdict on the PDF **fetched in this run and reported in `path`**: `verified`, or a refusal — `wrong_article`, `truncated`, `unreadable`, `no_reference`, `no_engine`. Null when nothing was judged: an XML artifact, a file already on disk, or any run under the tiered flags (`--prioritize-xml`, `--get-xml-or-html-and-pdf`, `--get-xml-and-pdf`, `--get-xml-and-html-and-pdf`, `--xml-only`, `--xml-html-only`), where the engine validates per tier instead. A success with a non-`verified` identity is a PDF that was kept rather than deleted because the verdict could not be trusted — see [the identity check](#format-prioritized-retrieval) — not one that passed. |
|
|
1193
1209
|
| `reasons` | list[str] | Why a record failed, or why a kept PDF could not be verified. Empty on a verified success. |
|
|
1194
|
-
| `paths` | list[str] | The other artifacts a tiered run wrote (`--get-xml-or-html-and-pdf`), empty otherwise. `path` is not repeated here. |
|
|
1210
|
+
| `paths` | list[str] | The other artifacts a tiered run wrote (`--get-xml-or-html-and-pdf` and its `--get-xml-and-pdf` / `--get-xml-and-html-and-pdf` variants), empty otherwise. `path` is not repeated here. |
|
|
1195
1211
|
| `supplementary` | object | Only with `--pull-supplementary` (or a flag that implies it): `status` (`ok`, `none_found`, `partial`, `incomplete`, `error`, `skipped`), `written`, `skipped`, `manifest` (absolute path or null), `missing_declared` (files the article declares that were not obtained) and `blocked_urls` (refused to this client; open them in a browser). |
|
|
1196
1212
|
| `figures` | object | Only with `--pull-figures`: `status`, `written`, `failed`, `refusal` and `manifest`. |
|
|
1197
1213
|
| `images` | object | Only with `--extract-images`: `status`, `written` and `manifest`. |
|
|
@@ -1429,7 +1445,7 @@ These run first when the DOI matches (by prefix, or by the name appearing anywhe
|
|
|
1429
1445
|
records whose key is entitled to the XML but not the PDF, and covers
|
|
1430
1446
|
ScienceDirect DOIs outside `10.1016/*`. It does not repeat a PDF request the
|
|
1431
1447
|
early step already made. The XML half is skipped with `--no-xml-fallback`.
|
|
1432
|
-
- With `--prioritize-xml` / `--xml-only` / `--get-xml
|
|
1448
|
+
- With `--prioritize-xml` / `--xml-only` / any `--get-xml-*-and-pdf` flag the tiered
|
|
1433
1449
|
ladder asks the same endpoint itself (`elsevier_tdm` at T1, `elsevier_pdf`
|
|
1434
1450
|
at T5, ahead of the legacy chain).
|
|
1435
1451
|
- **Off campus?** Entitlement is decided by your IP unless you also set
|
|
@@ -15,7 +15,7 @@ from .fetch_metadata_from_doi import fetch_metadata_from_doi
|
|
|
15
15
|
# behavioural difference, it is the same object.
|
|
16
16
|
fetch_pdf_from_doi = fetch_pdf
|
|
17
17
|
|
|
18
|
-
__version__ = "0.1.
|
|
18
|
+
__version__ = "0.1.9"
|
|
19
19
|
__all__ = [
|
|
20
20
|
"fetch_pdf",
|
|
21
21
|
"fetch_pdf_from_doi", # deprecated alias for fetch_pdf
|
|
@@ -5756,7 +5756,7 @@ def _append_missing_si_to_report(output_dir, si_statuses, run_timestamp, lock,
|
|
|
5756
5756
|
for display_id, summary in (si_statuses or {}).items():
|
|
5757
5757
|
status = getattr(summary, "status", "")
|
|
5758
5758
|
blocked_urls = list(getattr(summary, "blocked_urls", None) or [])
|
|
5759
|
-
if status not in ("partial", "incomplete"):
|
|
5759
|
+
if status not in ("partial", "incomplete", "blocked"):
|
|
5760
5760
|
continue
|
|
5761
5761
|
missing = ", ".join(getattr(summary, "missing_declared", None) or []) or "—"
|
|
5762
5762
|
# A withheld-but-existing supplement is the click-through candidate:
|
|
@@ -6426,6 +6426,11 @@ def _batch_fetch_pdfs_inner(dois, output_dir, email=None, verbose=False, delay=0
|
|
|
6426
6426
|
# point of the gate is that this cannot pass silently.
|
|
6427
6427
|
names = ", ".join(summary.missing_declared) or "unknown"
|
|
6428
6428
|
print(f" ⚠️ {display_id}: SI INCOMPLETE — missing: {names}")
|
|
6429
|
+
elif summary.status == "blocked":
|
|
6430
|
+
# Not "none found": a source refused or was down, so the paper
|
|
6431
|
+
# may well have supplements. Printed regardless of verbosity.
|
|
6432
|
+
print(f" ⚠️ {display_id}: SI BLOCKED — a supplement source refused "
|
|
6433
|
+
f"or was unavailable ({summary.detail or 'no detail'})")
|
|
6429
6434
|
elif summary.written and summary.status != "skipped":
|
|
6430
6435
|
extra = f", {summary.skipped} skipped" if summary.skipped else ""
|
|
6431
6436
|
print(f" 📎 {display_id}: {summary.written} supplementary file(s){extra}")
|
|
@@ -70,11 +70,13 @@ PROBES: Dict[str, str] = {
|
|
|
70
70
|
"informs": "10.1287/mnsc.2023.4866",
|
|
71
71
|
"science": "10.1126/science.abn1725",
|
|
72
72
|
"aha": "10.1161/circulationaha.121.058901",
|
|
73
|
+
"ieee": "10.1109/embc.2014.6943774",
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
PUBLISHER_NAMES = {"wiley": "Wiley", "tandf": "Taylor & Francis", "sage": "SAGE",
|
|
76
77
|
"springer": "Springer", "hogrefe": "Hogrefe", "informs": "INFORMS",
|
|
77
|
-
"science": "Science", "aha": "AHA Journals"
|
|
78
|
+
"science": "Science", "aha": "AHA Journals",
|
|
79
|
+
"ieee": "IEEE Xplore"}
|
|
78
80
|
|
|
79
81
|
CONFIG_DIR = inst.CONFIG_DIR
|
|
80
82
|
ACCESS_CONFIG = inst.ACCESS_CONFIG
|
|
@@ -448,15 +448,58 @@ def _prefix(doi: str) -> str:
|
|
|
448
448
|
return (doi or "").split("/")[0]
|
|
449
449
|
|
|
450
450
|
|
|
451
|
+
# --------------------------------------------------------------------------
|
|
452
|
+
# IEEE Xplore
|
|
453
|
+
# --------------------------------------------------------------------------
|
|
454
|
+
# IEEE keys every article by an "arnumber" that is not derivable from the DOI
|
|
455
|
+
# (10.1109/aina.2010.102 is document 5474692). Its landing pages sit behind
|
|
456
|
+
# AWS WAF -- a plain client gets HTTP 202 with an empty body -- so the arnumber
|
|
457
|
+
# cannot be scraped from them. doi.org's own redirect names it, though, and
|
|
458
|
+
# costs one request that never reaches IEEE. The PDF endpoint,
|
|
459
|
+
# stampPDF/getPDF.jsp, is not behind the WAF: without a session it redirects
|
|
460
|
+
# to Xplore/login.jsp, with one it serves the PDF. Measured 2026-11-08.
|
|
461
|
+
IEEE_PREFIX = "10.1109"
|
|
462
|
+
IEEE_SITE = "ieee.org"
|
|
463
|
+
_IEEE_ARNUMBER_RE = re.compile(r"ieeexplore\.ieee\.org/(?:abstract/)?document/(\d+)")
|
|
464
|
+
_ieee_lock = threading.Lock()
|
|
465
|
+
#: DOI -> arnumber. Only successful lookups are kept. Seeded with the
|
|
466
|
+
#: `fetchpdf cookies` test article so the wizard never needs the network to
|
|
467
|
+
#: know where IEEE lives.
|
|
468
|
+
_ieee_arnumbers = {"10.1109/embc.2014.6943774": "6943774"}
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def ieee_arnumber(doi: str, timeout: float = 30) -> Optional[str]:
|
|
472
|
+
"""IEEE Xplore's article number for *doi*, from doi.org's redirect; None if unknown."""
|
|
473
|
+
key = (doi or "").strip().lower()
|
|
474
|
+
with _ieee_lock:
|
|
475
|
+
if key in _ieee_arnumbers:
|
|
476
|
+
return _ieee_arnumbers[key]
|
|
477
|
+
url = f"https://doi.org/{key}"
|
|
478
|
+
try:
|
|
479
|
+
r = requests.get(url, allow_redirects=False, timeout=timeout,
|
|
480
|
+
headers=headers_for(url, {}))
|
|
481
|
+
m = _IEEE_ARNUMBER_RE.search(r.headers.get("location") or "")
|
|
482
|
+
except requests.RequestException:
|
|
483
|
+
return None
|
|
484
|
+
if not m:
|
|
485
|
+
return None
|
|
486
|
+
with _ieee_lock:
|
|
487
|
+
_ieee_arnumbers[key] = m.group(1)
|
|
488
|
+
return m.group(1)
|
|
489
|
+
|
|
490
|
+
|
|
451
491
|
def covers(doi: str) -> bool:
|
|
452
492
|
"""True if this route knows where the publisher keeps the DOI's PDF."""
|
|
453
493
|
prefix = _prefix(doi)
|
|
454
|
-
return prefix in PUBLISHER_PDF_TEMPLATES or prefix in PUBLISHER_LANDING_SITES
|
|
494
|
+
return (prefix in PUBLISHER_PDF_TEMPLATES or prefix in PUBLISHER_LANDING_SITES
|
|
495
|
+
or prefix == IEEE_PREFIX)
|
|
455
496
|
|
|
456
497
|
|
|
457
498
|
def publisher_sites(doi: str) -> List[str]:
|
|
458
499
|
"""The publisher sites whose cookies this DOI's fetch may use, main one first."""
|
|
459
500
|
prefix = _prefix(doi)
|
|
501
|
+
if prefix == IEEE_PREFIX:
|
|
502
|
+
return [IEEE_SITE]
|
|
460
503
|
if prefix in PUBLISHER_LANDING_SITES:
|
|
461
504
|
return list(PUBLISHER_LANDING_SITES[prefix])
|
|
462
505
|
article = publisher_article_url(doi)
|
|
@@ -469,6 +512,7 @@ def cookie_sites() -> List[str]:
|
|
|
469
512
|
for t in PUBLISHER_ARTICLE_TEMPLATES.values()}
|
|
470
513
|
for more in PUBLISHER_LANDING_SITES.values():
|
|
471
514
|
sites.update(more)
|
|
515
|
+
sites.add(IEEE_SITE)
|
|
472
516
|
return sorted(sites)
|
|
473
517
|
|
|
474
518
|
|
|
@@ -476,8 +520,12 @@ def publisher_article_url(doi: str) -> Optional[str]:
|
|
|
476
520
|
"""The article landing page on the publisher's own host, or None.
|
|
477
521
|
|
|
478
522
|
For a publisher in PUBLISHER_LANDING_SITES that is the DOI link, which
|
|
479
|
-
redirects there: its article URLs are not derivable from the DOI.
|
|
523
|
+
redirects there: its article URLs are not derivable from the DOI. For IEEE
|
|
524
|
+
it is the Xplore document page, which costs a doi.org lookup the first time.
|
|
480
525
|
"""
|
|
526
|
+
if _prefix(doi) == IEEE_PREFIX:
|
|
527
|
+
n = ieee_arnumber(doi)
|
|
528
|
+
return f"https://ieeexplore.ieee.org/document/{n}" if n else None
|
|
481
529
|
template = PUBLISHER_ARTICLE_TEMPLATES.get(_prefix(doi))
|
|
482
530
|
if template:
|
|
483
531
|
return template.format(doi=doi)
|
|
@@ -522,6 +570,9 @@ def _count_download() -> None:
|
|
|
522
570
|
|
|
523
571
|
def publisher_pdf_urls(doi: str) -> List[str]:
|
|
524
572
|
"""Canonical publisher PDF URLs for a DOI, or ``[]`` if none is derivable."""
|
|
573
|
+
if _prefix(doi) == IEEE_PREFIX:
|
|
574
|
+
n = ieee_arnumber(doi)
|
|
575
|
+
return [f"https://ieeexplore.ieee.org/stampPDF/getPDF.jsp?tp=&arnumber={n}"] if n else []
|
|
525
576
|
return [t.format(doi=doi) for t in PUBLISHER_PDF_TEMPLATES.get(_prefix(doi), [])]
|
|
526
577
|
|
|
527
578
|
|
|
@@ -606,6 +657,9 @@ _ELSEVIER_REDIRECT_RE = re.compile(r'name=["\']redirectURL["\'][^>]*value=["\'](
|
|
|
606
657
|
|
|
607
658
|
|
|
608
659
|
def _is_challenge(response) -> bool:
|
|
660
|
+
"""A Cloudflare challenge, or AWS WAF's (IEEE: 202 + x-amzn-waf-action)."""
|
|
661
|
+
if response.status_code == 202:
|
|
662
|
+
return bool(response.headers.get("x-amzn-waf-action"))
|
|
609
663
|
return (response.status_code in (403, 429, 503)
|
|
610
664
|
and "cloudflare" in (response.headers.get("server") or "").lower())
|
|
611
665
|
|
|
@@ -795,14 +849,21 @@ _FETCH_JS = """async ([u, cap]) => {
|
|
|
795
849
|
|
|
796
850
|
|
|
797
851
|
def wait_past_challenge(page, timeout_s: float = 30.0) -> bool:
|
|
798
|
-
"""Wait until the page is no longer a bot-challenge interstitial.
|
|
852
|
+
"""Wait until the page is no longer a bot-challenge interstitial.
|
|
853
|
+
|
|
854
|
+
Cloudflare names itself in the title; AWS WAF (IEEE Xplore) does not, but
|
|
855
|
+
its page carries the challenge script's globals.
|
|
856
|
+
"""
|
|
857
|
+
from .blocked import WAF_CHALLENGE_MARKERS
|
|
799
858
|
deadline = time.time() + timeout_s
|
|
800
859
|
while time.time() < deadline:
|
|
801
860
|
try:
|
|
802
861
|
title = (page.title() or "").lower()
|
|
862
|
+
body = page.content()[:20000] if "ieee.org" in (page.url or "") else ""
|
|
803
863
|
except Exception: # noqa: BLE001 - mid-navigation
|
|
804
|
-
title = "just a moment"
|
|
805
|
-
if not any(t in title for t in _CHALLENGE_TITLES)
|
|
864
|
+
title, body = "just a moment", ""
|
|
865
|
+
if not any(t in title for t in _CHALLENGE_TITLES) and \
|
|
866
|
+
not any(m in body for m in WAF_CHALLENGE_MARKERS):
|
|
806
867
|
return True
|
|
807
868
|
page.wait_for_timeout(1000)
|
|
808
869
|
return False
|
|
@@ -74,6 +74,17 @@ def atypon_host_for(doi: str) -> Optional[str]:
|
|
|
74
74
|
return _ATYPON_HOSTS.get(prefix)
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
def note_blocked(ctx, provider: str, url: str, detail: str) -> None:
|
|
78
|
+
"""Record that a provider was refused, so the manifest can say "blocked".
|
|
79
|
+
|
|
80
|
+
An empty list alone reads as "nothing listed", which claims the article has
|
|
81
|
+
no supplements. A refused listing page proves nothing of the sort.
|
|
82
|
+
"""
|
|
83
|
+
scratch = getattr(ctx, "scratch", None)
|
|
84
|
+
if isinstance(scratch, dict):
|
|
85
|
+
scratch.setdefault("_provider_blocked", {})[provider] = {"url": url, "detail": detail}
|
|
86
|
+
|
|
87
|
+
|
|
77
88
|
def headed_browser_available() -> bool:
|
|
78
89
|
"""Whether a headed Chromium can actually be launched here.
|
|
79
90
|
|
|
@@ -190,6 +201,7 @@ def fetch_atypon_supplements(ids, ctx) -> List[SupplementFile]:
|
|
|
190
201
|
status = response.status if response else None
|
|
191
202
|
if status != 200:
|
|
192
203
|
ctx.log(f" atypon SI: listing page HTTP {status}")
|
|
204
|
+
note_blocked(ctx, "atypon_suppl", listing, f"listing page HTTP {status}")
|
|
193
205
|
return []
|
|
194
206
|
page.wait_for_timeout(_SETTLE_MS)
|
|
195
207
|
|