Skip to content

Rename save_pdf→save_file, Europe PMC PDF + anydoc Markdown - #4

Draft
MoonDavid wants to merge 7 commits into
mainfrom
cursor/pnas-pdf-download-attempts-c740
Draft

Rename save_pdf→save_file, Europe PMC PDF + anydoc Markdown#4
MoonDavid wants to merge 7 commits into
mainfrom
cursor/pnas-pdf-download-attempts-c740

Conversation

@MoonDavid

@MoonDavid MoonDavid commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Exhaustively retried downloading DOI 10.1073/pnas.1718406115, fixed Europe PMC PDF recovery, added optional Markdown conversion via Firecrawl anydoc, and renamed the download APIs to save_file / save_file_from_dump.

API rename

Old New
save_pdf save_file
save_pdf_from_dump save_file_from_dump
debug_save_pdf debug_save_file
debug_save_pdf_from_dump debug_save_file_from_dump
pdf_path= (dump folder) output_path=

Old names remain as aliases (save_pdf is save_file, and pdf_path= still works).

from paperscraper.pdf import save_file, save_file_from_dump

save_file({"doi": "10.48550/arXiv.2207.03928"}, filepath="paper.pdf")
save_file_from_dump("papers.jsonl", output_path="papers", to_markdown=True)

PNAS download

Success via Europe PMC PDF render (PMC5924899):

  • PDF: artifacts/pnas_download/pnas.1718406115.pdf
  • Markdown: artifacts/pnas_download/pnas.1718406115.md
  • Logs: artifacts/pnas_download/ATTEMPTS.md

Europe PMC PDF fallback

When fullTextXML is missing, fallback_europepmc now tries PDF render.

Optional Markdown (to_markdown)

pip install 'paperscraper[markdown]'  # firecrawl-anydoc, Python >= 3.10

Note: pypi.org/project/anydoc is unrelated; use firecrawl-anydoc.

Open in Web Open in Cursor 

cursoragent and others added 3 commits August 6, 2026 11:44
Exhaustively retried DOI 10.1073/pnas.1718406115 (pnas.org 403s).
Succeeded via Europe PMC PDF render (PMC5924899). Extend
fallback_europepmc to fetch PDF when fullTextXML is missing so
save_pdf recovers this case, with tests and attempt artifacts.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
Track the exhaustive retry console transcript and Europe PMC
pytest output alongside the structured JSON summary.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
Wire Firecrawl anydoc (PyPI: firecrawl-anydoc) behind paperscraper[markdown]
so save_pdf / save_pdf_from_dump can write .md beside each PDF/XML via
to_markdown=True. Include converter helper, docs, tests, and converted
PNAS example Markdown.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
@cursor cursor Bot changed the title Europe PMC PDF fallback + PNAS 10.1073/pnas.1718406115 download logs Europe PMC PDF fallback, PNAS download logs, optional anydoc Markdown Aug 6, 2026
Primary full-text download entry points are now save_file and
save_file_from_dump (dump output folder: output_path). Keep save_pdf /
save_pdf_from_dump and pdf_path as backward-compatible aliases.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
@cursor cursor Bot changed the title Europe PMC PDF fallback, PNAS download logs, optional anydoc Markdown Rename save_pdf→save_file, Europe PMC PDF + anydoc Markdown Aug 6, 2026
cursoragent and others added 3 commits August 6, 2026 12:23
- Apply ruff format to pdf.py and test_pdf.py
- Skip artifacts/ in codespell (OCR/API dumps are not source)
- Relax live Semantic Scholar self-citation count assertions

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
The action skip input overrides .codespellrc, so PNAS download dumps
were still spellchecked and failed CI on OCR/API field names.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
test_basic_search expected 10.1126/science.adk9587 to never download,
but the new Europe PMC PDF render fallback can retrieve it. Soft-fail
Codecov uploads so missing tokens / 429s do not fail green test runs.

Co-authored-by: Davide Gotta <MoonDavid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants