Handle Cloudflare challenge on eprint.iacr.org PDF downloads - #15
Open
rex1fernando wants to merge 1 commit into
Open
Handle Cloudflare challenge on eprint.iacr.org PDF downloads#15rex1fernando wants to merge 1 commit into
rex1fernando wants to merge 1 commit into
Conversation
eprint.iacr.org now serves .pdf paths behind a Cloudflare managed JS
challenge ("Just a moment..."), which 403s urllib -- and also curl and
even browser-TLS-impersonating clients, so there is no clean
programmatic bypass. The abstract pages are not challenged, so BibTeX
scraping still works.
Changes to iacreprint_handler:
- Scrape the BibTeX first, from the already-fetched abstract page.
- On a 403 for the PDF, fall back to opening the PDF URL in the user's
browser (same pattern as dlacm_handler) and return no PDF data.
To keep 'ck add' hands-off beyond solving the challenge, the manual
"save the PDF and press a key" step is now automated: ck watches the
browser's download directory (new optional DownloadsDir config key,
default ~/Downloads) and auto-files the PDF the user downloads under
its citation key, after a single confirm. Saving directly to the
destination path and the old manual flow still work as fallbacks.
This also benefits the dl.acm.org handler, which shares this path.
The IACR PDF integration test now monkeypatches click.launch (no
browser windows during test runs) and accepts both outcomes: a direct
download if Cloudflare ever unblocks, or the browser fallback.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
eprint.iacr.org now serves
.pdfpaths behind a Cloudflare managed JS challenge (cf-mitigated: challenge, "Just a moment…"), which 403s urllib — and also curl and even browser-TLS-impersonating clients (tested withcurl_cffi), so there is no clean programmatic bypass. Abstract pages are not challenged, so BibTeX scraping still works.iacreprint_handlerchanges:dlacm_handler) and returns no PDF data.Auto-filing the browser download: so that
ck addstays hands-off beyond solving the challenge, the manual "save the PDF and press a key" step is automated.ck addnow watches the browser's download directory and, when the PDF the user downloaded appears, files it under the citation key after a single confirm (default Yes). Details:DownloadsDirconfig key (defaults to~/Downloads), documented inck-sample.config..crdownload/.part/.downloadand atomically rename to the final.pdfon completion.dl.acm.orghandler benefits too, since it shares this code path.The IACR PDF integration test now monkeypatches
click.launch(no browser windows during test runs) and accepts both outcomes: a direct download if Cloudflare ever unblocks, or the browser fallback.Test plan
wait_for_browser_pdf): fresh vs. old files, partial/zero-byte files, direct-to-destination saves, newest-wins, timeoutsck add https://eprint.iacr.org/2018/721with a scratch config hit the real Cloudflare 403, opened the browser, detected a PDF dropped into a fake Downloads dir mid-wait, and filed it asTBP+18e.pdf(moved, not copied) alongside the auto-downloaded.bib🤖 Generated with Claude Code