fix: update USER_AGENT to mimic browser to bypass publisher WAFs#119
fix: update USER_AGENT to mimic browser to bypass publisher WAFs#119vedant1711 wants to merge 1 commit into
Conversation
|
The branch carries the 4 commits from the OSTI spider work (14e200a, 56afb6c, b66ac78, 7076e75), which already landed on main via PR #107 that was squashed and merged. They're harmless, but make it hard to see what this PR is actually doing. If you want to clean that up before we merge, this drops them and keeps just your commit: |
|
Regarding commit dc9a6c0: I'm concerned that changing the base setting for USER_AGENT to conceal who we are goes against a P1 functional requirement that "System shall obey robots.txt and other scraping etiquette, such as limiting the number of parallel requests to the same domain." If we do want to circumvent that for OSTI's unreasonable settings, it would be better to do it via Moreover, if I am understanding correctly, setting |
Publisher CloudFront WAFs block the default self-identifying user-agent for the open-access fulltext PDFs OSTI links to. Move the workaround out of base.py (which left the honest default untouched and was overridden by production.py anyway) and into the OSTI spider's custom_settings, matching the ROBOTSTXT_OBEY pattern. The UA is browser-shaped but still names the project and a contact address. Co-Authored-By: Claude Opus 4.8 <[email protected]>
dc9a6c0 to
e6b38c0
Compare
|
Thanks @boyechko. Both points well taken, and honestly you've made me want to question this change rather than defend it. Branch hygiene: done. I rebased with The change itself: you're right on all three counts. "USER_AGENT": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 "
"(open_ire; +https://lib.uw.edu/; contact [email protected])"
)The idea: browser-shaped (to slip past WAFs that block anything "script-like") but still naming the project plus a contact address, so we're not hiding who we are. That said, I'm not convinced we should do this at all, and I'd rather decide together:
I left a |
Updates the spider's USER_AGENT to a standard Chrome browser string to bypass publisher Bot Protections and CloudFront WAFs that were blocking PDF downloads for open access articles.