switchback 0.6.1__tar.gz → 0.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {switchback-0.6.1 → switchback-0.6.2}/CHANGELOG.md +12 -0
- {switchback-0.6.1 → switchback-0.6.2}/PKG-INFO +1 -1
- {switchback-0.6.1 → switchback-0.6.2}/pyproject.toml +1 -1
- {switchback-0.6.1 → switchback-0.6.2}/switchback/policy/gates.py +18 -3
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/PKG-INFO +1 -1
- {switchback-0.6.1 → switchback-0.6.2}/.env.example +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/CONTRIBUTING.md +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/LICENSE +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/MANIFEST.in +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/NOTICE +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/README.md +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/SECURITY.md +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/clients/node_bridge.md +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/clients/python_client.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/config/botwall_skip_urls.txt +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/config/extraction.example.json +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/setup.cfg +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/__init__.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/__main__.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/api.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/concurrency.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/content_cache.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/doctor.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/egress.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/extract.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/flags.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/highlights.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/mcp_server.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/normalize.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/orchestrator.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/policy/__init__.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/policy/botwall.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/py.typed +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/reporting.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/search.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/server.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/session_cache.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/session_trace.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/state.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/__init__.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/_browser.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_1.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_2.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_3.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_4.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_5.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_6.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tiers/tier_7.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback/tracing.py +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/SOURCES.txt +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/dependency_links.txt +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/entry_points.txt +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/requires.txt +0 -0
- {switchback-0.6.1 → switchback-0.6.2}/switchback.egg-info/top_level.txt +0 -0
|
@@ -4,6 +4,18 @@ All notable changes to this project are documented here. Format loosely follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/); this project uses semantic-ish
|
|
5
5
|
versioning while pre-1.0.
|
|
6
6
|
|
|
7
|
+
## [0.6.2] - 2026-10-14
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Block pages hidden behind inline images were returned as successes.** A
|
|
11
|
+
bot-wall page that embeds its logo as a base64 `data:` image (e.g. Indeed's
|
|
12
|
+
Cloudflare block page, ~7k chars of SVG before "You have been blocked") pushed
|
|
13
|
+
the block phrase past the 600-char head scan *and* cleared the 2000-char length
|
|
14
|
+
floor on image bytes alone, so a browser tier reported `OK` with the block page
|
|
15
|
+
as content. The quality gates now ignore inline `data:` payloads when scanning
|
|
16
|
+
and measuring (returned markdown is unchanged), and Cloudflare's WAF copy "you
|
|
17
|
+
have been blocked" is a recognised wall (vendor `cloudflare`).
|
|
18
|
+
|
|
7
19
|
## [0.6.1] - 2026-10-14
|
|
8
20
|
|
|
9
21
|
### Fixed
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "switchback"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "One cost-ordered scrape cascade (HTTP → stealth browser → paid), shared by every tool."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -55,11 +55,24 @@ _BOTWALL_MARKERS = (
|
|
|
55
55
|
("humans only", "datadome"), # DataDome (e.g. Glassdoor)
|
|
56
56
|
("access denied", "akamai"), # Akamai / generic 403
|
|
57
57
|
("unusual traffic from your computer", "google"), # Google bot interstitial
|
|
58
|
+
("you have been blocked", "cloudflare"), # CF WAF block ("Sorry, you have been blocked")
|
|
58
59
|
("are you a human", "generic"),
|
|
59
60
|
("ddos protection by", "generic"), # generic CDN challenge
|
|
60
61
|
)
|
|
61
62
|
_BOTWALL_HEAD_CHARS = 600
|
|
62
63
|
|
|
64
|
+
# Inline base64 images: ``. Block pages often
|
|
65
|
+
# embed their logo this way, and a single one can run to thousands of chars —
|
|
66
|
+
# enough to push the block phrase out of the head window and to clear the length
|
|
67
|
+
# floor on its own. Base64 never contains ')' or whitespace, so this is exact.
|
|
68
|
+
_INLINE_DATA_URI = re.compile(r"\(data:[^)\s]*\)")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _strip_inline_data(md: str) -> str:
|
|
72
|
+
"""`md` with inline data-URI payloads emptied (`` -> `![]()`), so
|
|
73
|
+
the gates measure and scan text, not image bytes."""
|
|
74
|
+
return _INLINE_DATA_URI.sub("()", md)
|
|
75
|
+
|
|
63
76
|
|
|
64
77
|
def classify_botwall(md: str | None) -> str | None:
|
|
65
78
|
"""Return the vendor of the bot-wall in the head of `md` (cloudflare /
|
|
@@ -67,7 +80,7 @@ def classify_botwall(md: str | None) -> str | None:
|
|
|
67
80
|
the content doesn't look like a wall. First marker match wins."""
|
|
68
81
|
if not md:
|
|
69
82
|
return None
|
|
70
|
-
head = md[:_BOTWALL_HEAD_CHARS].lower()
|
|
83
|
+
head = _strip_inline_data(md)[:_BOTWALL_HEAD_CHARS].lower()
|
|
71
84
|
for marker, vendor in _BOTWALL_MARKERS:
|
|
72
85
|
if marker in head:
|
|
73
86
|
return vendor
|
|
@@ -189,13 +202,15 @@ def check(url: str, md: str | None) -> str:
|
|
|
189
202
|
vendor = classify_botwall(md)
|
|
190
203
|
if vendor:
|
|
191
204
|
raise BotWall(f"bot-wall / block page detected ({vendor})", vendor=vendor)
|
|
205
|
+
# Measure text, not inline image bytes; the caller still gets `md` unchanged.
|
|
206
|
+
text = _strip_inline_data(md or "")
|
|
192
207
|
gate = min_len_for(url)
|
|
193
|
-
n = len(
|
|
208
|
+
n = len(text)
|
|
194
209
|
if n < gate:
|
|
195
210
|
raise ShortContent(f"body too short: {n} < {gate}")
|
|
196
211
|
# Length cleared, but is it actually content? Reject shells/placeholders so a
|
|
197
212
|
# tier falls through instead of returning a confident false-positive success.
|
|
198
|
-
shell = _content_shell_reason(
|
|
213
|
+
shell = _content_shell_reason(text)
|
|
199
214
|
if shell:
|
|
200
215
|
raise ShortContent(f"no article content: {shell}")
|
|
201
216
|
return md
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|