mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
fix(amazon): update anti-bot detection logic to include soft responses
This commit is contained in:
parent
603c94c80b
commit
94b16a8334
1 changed files with 7 additions and 2 deletions
|
|
@ -84,8 +84,13 @@ async def gather_bounded[T](
|
|||
|
||||
|
||||
def is_blocked(html: str | None, status: int) -> bool:
|
||||
"""Return whether a response is an Amazon anti-bot interstitial."""
|
||||
if status in {429, 503}:
|
||||
"""Return whether a response is an Amazon anti-bot interstitial.
|
||||
|
||||
``202`` is a soft anti-bot response Amazon serves to some proxy exits (an
|
||||
empty/accepted body rather than the page), so it is treated as blocked and
|
||||
retried on a fresh exit rather than parsed as a real page.
|
||||
"""
|
||||
if status in {202, 429, 503}:
|
||||
return True
|
||||
text = (html or "")[:200_000].lower()
|
||||
return any(marker in text for marker in _BLOCK_MARKERS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue