Skip to content

fix: compatibility with arxiv Python package v4.0.0#116

Open
donghao1393 wants to merge 1 commit into
blazickjp:mainfrom
donghao1393:fix/arxiv-v4-compat
Open

fix: compatibility with arxiv Python package v4.0.0#116
donghao1393 wants to merge 1 commit into
blazickjp:mainfrom
donghao1393:fix/arxiv-v4-compat

Conversation

@donghao1393

Copy link
Copy Markdown

Problem

arxiv Python package v4.0.0 removed Result.pdf_url and Result.download_pdf(), breaking PDF downloads for all papers that lack HTML versions (typically papers published before ~2024).

Error: 'Result' object has no attribute 'download_pdf'

Also tracked in issue #114.

Changes

Three files, 12 lines changed:

File Change
tools/download.py Replace paper.pdf_url with canonical https://arxiv.org/pdf/{short_id}.pdf
tools/search.py Same — fix paper URL in search results
resources/papers.py Replace paper.download_pdf() with httpx streaming download

Root cause

arxiv Python library v4.0.0 removed:

  • Result.pdf_url property → use Result.get_short_id() to construct canonical URL
  • Result.download_pdf() method → use httpx streaming (already used by _download_arxiv_pdf_to_path)

The _download_arxiv_pdf_to_path() function in download.py already used httpx streaming to avoid incomplete downloads (issue #98), so papers.py was the only place still calling download_pdf() directly.

Testing

  • Verified PDF download + markdown conversion for 2308.04079 (3DGS paper, no HTML version)
  • All existing HTML downloads continue to work
  • Search results correctly populate PDF URLs

- Replace removed Result.pdf_url with canonical arXiv PDF URL using get_short_id()
- Replace removed Result.download_pdf() with httpx streaming download
- Fix search.py paper URL construction for v4 API compatibility
- arxiv v4 removed pdf_url property and download_pdf method from Result class

修复:适配 arxiv Python 包 v4.0.0

一、Result 类的 pdf_url 属性在 v4 中被移除,改用 get_short_id() 拼接正规 arXiv PDF URL
二、Result 类的 download_pdf() 方法在 v4 中被移除,改用 httpx 流式下载,每条文件代码变更对等展开
三、同步修复 search.py 中的 paper URL 构造,保证搜索结果的 PDF 链接正确
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.

1 participant