Repository navigation
fix(download-ref): don't stall on Semantic Scholar 429s; hand chemistry PDFs to a person - #81
Merged
Conversation
…ry PDFs to a person Without an API key the shared Semantic Scholar pool often returns 429 for minutes. post_batch backed off 5+10+20+40+80 s per call, and when it gave up, arXiv IDs had no metadata at all and Crossref-only DOIs lost their preprint link. Agents re-ran the fetch and sessions sat for half an hour. - post_batch gives up after ~9 s (two retries) and points at SEMANTIC_SCHOLAR_API_KEY. - arXiv IDs fall back to the arXiv API (title, authors, abstract, DOI, BibTeX; metadata_source "arxiv", accepted by verify_bib). - Crossref-only DOIs look up an arXiv preprint by exact title. - AIP (10.1063), ACS (10.1021) and RSC (10.1039) serve PDFs only after a Cloudflare human check, even to subscribed IPs. Those misses are now printed as links (through SCIBRAIN_PROXY_PREFIX when set), and the new import_pdfs.py matches the PDFs a person saves to the pending DOIs by DOI or exact title and copies them into .raw/doi/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
LGTM, thank you! |
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.
Problem
Adding JCP/AIP-style references often looked stuck. Without
SEMANTIC_SCHOLAR_API_KEY, the shared S2 pool returns 429 for minutes at a time, andpost_batchbacked off 5+10+20+40+80 s per call. When it gave up:miss arxiv:…);externalIds.ArXiv, so the free-preprint fallback never ran.In one real session, agents re-ran the fetch several times and adding about 10 papers took over 30 minutes.
On top of that, AIP (
10.1063), ACS (10.1021) and RSC (10.1039) answer scripts and headless browsers with a Cloudflare "Just a moment..." page, even from a subscribed network. APS (10.1103) serves the PDF directly to subscribed IPs, and most APS papers have arXiv versions, which is why physics batches don't hit this.Changes
post_batchgives up after about 9 s (two retries) and suggests settingSEMANTIC_SCHOLAR_API_KEY.export.arxiv.org. Records carry title, authors, year, abstract, journal DOI and@miscBibTeX witheprint, and are markedmetadata_source: "arxiv";verify_bib._load_cacheaccepts these.externalIds.ArXiv.10.1063/,10.1021/and10.1039/are printed as links, throughSCIBRAIN_PROXY_PREFIXwhen set. The newhelpers/import_pdfs.pyscans recent PDFs (default~/Downloads, last 14 days), matches each to a pending DOI by the DOI printed in it (with a boundary check) or by exact title, and copies it into.raw/doi/<safe>.pdf. Unmatched files are left alone.SKILL.mdandreferences/acquisition.mddescribe the flow.Verification
10.1063/5.0157512got its PDF via the preprint it found by title; the other two had no preprint and were listed as links.import_pdfs.pywas run against a real KB. The final step, a person downloading AIP PDFs, has not been exercised yet.🤖 Generated with Claude Code