Refactor CSDN exporter: remove aria2, add headers, improve safety#16
Refactor CSDN exporter: remove aria2, add headers, improve safety#16google-labs-jules[bot] wants to merge 4 commits intomasterfrom
Conversation
- Removed `aria2c` dependency; images are now downloaded using `httpx`. - Added User-Agent headers to all requests to mitigate anti-scraping blocks. - Replaced `os.system` with `subprocess.run` for safer PDF generation. - Added error handling for network requests and HTML parsing.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Fixed `[Errno 0] Error` by adding `verify=False` to `httpx` requests, bypassing SSL handshake issues. - Fixed `AttributeError` in `utils.py` caused by attempting to set the read-only `.string` property of `NavigableString` in newer BeautifulSoup versions. - Removed `aria2c` dependency; images are now downloaded using `httpx`. - Added User-Agent headers to all requests to mitigate anti-scraping blocks. - Replaced `os.system` with `subprocess.run` for safer PDF generation. - Added robust error handling for network requests and HTML parsing.
- Fixed `[Errno 0] Error` by forcing HTTP/1.1 (`http2=False`) and bypassing SSL verification (`verify=False`) in `httpx` requests. - Fixed `AttributeError` in `utils.py` caused by attempting to set the read-only `.string` property of `NavigableString`. - Removed `aria2c` dependency; images are now downloaded natively using `httpx`. - Added User-Agent headers to all requests to mitigate anti-scraping blocks. - Replaced `os.system` with `subprocess.run` for safer PDF generation. - Added robust error handling for network requests and HTML parsing.
- Fixed `[Errno 0] Error` by forcing HTTP/1.1 (`http2=False`), bypassing SSL verification (`verify=False`), and adding session warm-up logic. - Fixed `AttributeError` in `utils.py` caused by attempting to set the read-only `.string` property of `NavigableString`. - Removed `aria2c` dependency; images are now downloaded natively using `httpx`. - Added comprehensive browser headers (User-Agent, Referer, Accept) to bypass anti-scraping blocks. - Replaced `os.system` with `subprocess.run` for safer PDF generation. - Added robust error handling for network requests and HTML parsing.
This PR refactors the CSDN Exporter tool to fix broken functionality and improve code quality.
Key changes:
aria2cCLI tool with Python's nativehttpxlibrary for downloading images. This simplifies setup and removes a hard dependency.os.systemcalls withsubprocess.run(using argument lists) for invoking Pandoc. This prevents potential shell injection vulnerabilities.subprocess,httpx) and cleaned up some string formatting.PR created automatically by Jules for task 3611971521208238884 started by @axzml