Skip to content

Commit fe5175b

Browse files
todieclaude
andcommitted
fix: scrapling 0.4.3 API + websockify pip install + X11 socket dir
- Scrapling API changed: Fetcher/StealthyFetcher not Scraper/StealthFetcher, .get() not .fetch(), .text not .text() - Added websockify pip package (noVNC needs it on PATH) - Created /tmp/.X11-unix with sticky bit before Xvfb starts - Updated MCP tool dispatch in connect and serve commands - Updated e2e test for scrapling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1af0136 commit fe5175b

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
4747
&& npm install -g computer-use-mcp \
4848
&& rm -rf /var/lib/apt/lists/*
4949

50-
# Layer 4: Playwright + Scrapling
50+
# Layer 4: Playwright + Scrapling + websockify
5151
RUN pip install --break-system-packages \
5252
playwright \
5353
"scrapling[fetchers]" \
54+
websockify \
5455
&& playwright install chromium \
5556
&& scrapling install \
5657
|| true
@@ -65,9 +66,11 @@ RUN git_url="https://github.com/novnc/noVNC.git" && \
6566
# Layer 6: reach-supervisor binary
6667
COPY --from=builder /build/target/release/reach-supervisor /usr/local/bin/reach-supervisor
6768

68-
# Layer 7: User + permissions
69+
# Layer 7: User + permissions + X11 socket dir
6970
RUN useradd -m -s /bin/bash sandbox \
70-
&& echo "sandbox ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
71+
&& echo "sandbox ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
72+
&& mkdir -p /tmp/.X11-unix \
73+
&& chmod 1777 /tmp/.X11-unix
7174

7275
# Chrome policies — disable auto-updates, first-run
7376
COPY config/chrome-policies.json /etc/opt/chrome/policies/managed/reach.json

crates/reach-cli/src/commands/connect.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ async fn dispatch_tool(
133133
let url = args.get("url").and_then(|v| v.as_str()).unwrap_or("");
134134
let selector = args.get("selector").and_then(|v| v.as_str()).unwrap_or("body");
135135
let stealth = args.get("stealth").and_then(|v| v.as_bool()).unwrap_or(true);
136-
let fetcher = if stealth { "StealthFetcher" } else { "Scraper" };
136+
let fetcher = if stealth { "StealthyFetcher" } else { "Fetcher" };
137137
let script = format!(
138-
"from scrapling import {fetcher}; r = {fetcher}().fetch('{url}'); \
138+
"from scrapling import {fetcher}; r = {fetcher}().get('{url}'); \
139139
elems = r.css('{selector}'); \
140-
import json; print(json.dumps([{{'content': e.text(), 'tag': e.tag}} for e in elems]))"
140+
import json; print(json.dumps([{{'content': e.text, 'tag': e.tag}} for e in elems]))"
141141
);
142142
exec_python(docker, target, &script).await
143143
}

crates/reach-cli/src/commands/serve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ async fn dispatch(
172172
let url = args.get("url").and_then(|v| v.as_str()).unwrap_or("");
173173
let sel = args.get("selector").and_then(|v| v.as_str()).unwrap_or("body");
174174
let stealth = args.get("stealth").and_then(|v| v.as_bool()).unwrap_or(true);
175-
let f = if stealth { "StealthFetcher" } else { "Scraper" };
175+
let f = if stealth { "StealthyFetcher" } else { "Fetcher" };
176176
py(
177177
state,
178178
target,
179179
&format!(
180-
"from scrapling import {f}; r = {f}().fetch('{url}'); \
180+
"from scrapling import {f}; r = {f}().get('{url}'); \
181181
elems = r.css('{sel}'); \
182-
import json; print(json.dumps([{{'content': e.text(), 'tag': e.tag}} for e in elems]))"
182+
import json; print(json.dumps([{{'content': e.text, 'tag': e.tag}} for e in elems]))"
183183
),
184184
)
185185
.await

tests/e2e_container.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn scrapling_can_scrape_page() {
393393
assert!(wait_for_health(30));
394394

395395
let out = exec_in_container(
396-
"python3 -c \"from scrapling import Scraper; r = Scraper().fetch('https://example.com'); print(r.css('h1').text())\""
396+
"python3 -c \"from scrapling import Fetcher; r = Fetcher().get('https://example.com'); print(r.css('h1')[0].text)\""
397397
);
398398
let stdout = String::from_utf8_lossy(&out.stdout);
399399
assert!(

0 commit comments

Comments
 (0)