diff --git a/db.py b/db.py index b30a374..a0a3580 100644 --- a/db.py +++ b/db.py @@ -29,6 +29,10 @@ def _is_blocked_response(html, status_code): return True if "enable javascript and cookies" in html_lower: return True + if "request rejected" in html_lower: + return True + if "access denied" in html_lower: + return True return False @@ -295,7 +299,7 @@ def fetch_page(url): resp = requests.get(url, timeout=10, headers={"User-Agent": "TinyWeb/1.0"}, allow_redirects=False) if _is_blocked_response(resp.text, resp.status_code): - raise Exception("Site blocks automated access (Cloudflare/CDN protection)") + raise Exception(f"Site blocks automated access: {resp.status_code}") # Follow redirects manually, re-validating each target max_redirects = 5