Web scraping trong Windsurf
Windsurf nay được gọi là Devin Desktop. Thêm MCP server Spicrawl và agent của nó có thể đọc trang web dưới dạng Markdown sạch.
Thiết lập
Devin Desktop có hai agent. Devin Local là mặc định cho tab mới. Cascade là agent cũ. Chúng đọc MCP server từ các tệp khác nhau, nên hãy thiết lập cái bạn dùng.
Đặt API key của bạn trong môi trường mà Devin Desktop khởi động từ đó:
bashexport SPICRAWL_API_KEY=spicrawl_live_... # add to your shell profile, then restart Devin DesktopDevin Local: thêm server ở phạm vi local. Nó được lưu vào
.devin/mcp_config.local.json, tệp mà Devin gitignore. Kiểm tra bằngdevin mcp list.bashdevin mcp add spicrawl https://mcp.spicrawl.com/mcp -H "Authorization: Bearer $SPICRAWL_API_KEY"Đừng dùng
-s project. Nó ghi vào tệp dùng chung, được commit, kèm key của bạn.Cascade: mở bảng Cascade, nhấp vào menu
...và mở tệp cấu hình MCP. Thêm server. Cascade tự điền key, nên tệp không chứa key:~/.config/devin/mcp_config.json{ "mcpServers": { "spicrawl": { "serverUrl": "https://mcp.spicrawl.com/mcp", "headers": { "Authorization": "Bearer ${env:SPICRAWL_API_KEY}" } } } }Cascade cho phép 100 tool trên tất cả các server. Spicrawl dùng 25 trong số đó.
Cài skill:
bashspicrawl skill install --client codex # Without the CLI: mkdir -p .agents/skills/spicrawl curl -fsSL https://app.spicrawl.com/skill.md -o .agents/skills/spicrawl/SKILL.mdLưu rule này thành
.devin/rules/spicrawl.md(.windsurf/rules/vẫn dùng được). Agent đọc nó khi một tác vụ liên quan đến dữ liệu web..devin/rules/spicrawl.md--- trigger: model_decision description: Fetching, scraping or extracting data from web pages with Spicrawl --- # Web data (Spicrawl) Use Spicrawl to read web pages: the spicrawl_* MCP tools in chat, or POST https://api.spicrawl.com/v1/scrape with `Authorization: Bearer $SPICRAWL_API_KEY` in code. Docs: https://docs.spicrawl.com/llms.txt (append .md to any page URL for Markdown). - Ask for markdown: `response_format: "markdown"` (API default is html); on spicrawl_scrape, `format: "markdown"`. - Check the site's status, not only the HTTP status: `X-Target-Status` header, or `status` in the JSON envelope (spicrawl_scrape with `format: "json"`). 200 is the page; 404/410 mean it does not exist; 403/429/503 mean the site refused, so escalate. - On an error, switch on `code`. Retry only when `retryable` is true, after `retry_after_seconds`. Read `diagnostics.hint` and change what it names first. Never retry ERR::REQUEST::*, ERR::AUTH::* or ERR::LIMIT::QUOTA_EXCEEDED. - Escalate one step at a time and stop at the first that works: plain fetch (1 credit) -> `js_render: true` (3) -> add the user's own `proxy` if they have one. Empty or skeleton content means render; ERR::UPSTREAM::CHALLENGE or a 403 target status means retry once, then the user's own proxy. - Set `max_cost` on every request to the price of the step you intend. - Keep the cache on (default). Set `cache: false` only for prices, stock or other live data. - Trim tokens with `main_content_only` (on by default for markdown), `include_tags`, `exclude_tags`. - For more than 20 URLs, use a batch job (spicrawl_batch_submit / POST /v1/batch). Batch items return html, markdown or text (spicrawl_batch_submit defaults to markdown, POST /v1/batch to html). Extraction, screenshots, actions and sessions are refused with a 400 before anything is charged: scrape those URLs one by one. - Never print or commit SPICRAWL_API_KEY. Log `X-Request-Id` for failures.
Một tác vụ đầu tiên để thử
Mở một tab agent mới và hỏi:
Use Spicrawl to read https://example.com/pricing as markdown. List each plan with its monthly price.
If the page comes back empty, retry with rendering.Agent nên gọi spicrawl_scrape với format: "markdown". Nó chỉ nên thêm render: true nếu kết quả đầu tiên rỗng.
Nó làm được gì
Server cung cấp cho agent 25 tool spicrawl_*. Mỗi lệnh gọi chạy dưới API key của bạn, với cùng giới hạn và credit như một lệnh gọi API trực tiếp.
- Đọc một trang:
spicrawl_scrapetrả về Markdown (mặc định), text, HTML, JSON hoặc PDF. - Đọc nhiều trang:
spicrawl_batch_submitxếp hàng tới 10,000 URL. Sau đó dùngspicrawl_batch_statusvàspicrawl_batch_results. - Trang sau màn hình đăng nhập:
spicrawl_session_creategiữ cookie và bộ nhớ lưu trữ giữa các lệnh gọi. - Gỡ lỗi một sự cố:
spicrawl_requests_listvàspicrawl_request_get. - Kiểm tra mức dùng:
spicrawl_usage_summaryvà các tool về mức dùng khác. Các tool này cần key có scoperead. - Tra cứu:
spicrawl_docs_searchvàspicrawl_docs_readtìm kiếm và đọc tài liệu Spicrawl.
Có một tool, spicrawl_browser_connect_url, được liệt kê nhưng sắp ra mắt. Trên spicrawl_scrape, đối số render là render, không phải js_render của API.
Nên biết
- Không crawl. Spicrawl không đi theo liên kết hay tự tìm trang. Hãy đưa các URL cho agent.
- Credit cho mỗi request. Một lần fetch thường là 1 credit. Render JavaScript là 3. Render bằng trình duyệt đầy đủ là 8.
- Thất bại là miễn phí. Request thất bại tốn 0 credit.
- Cache tiết kiệm thời gian, không tiết kiệm credit. Một lần trúng cache tốn bằng lần fetch đã lưu nó.
- Giới hạn từng lệnh gọi. Đặt
max_cost, và một request có thể tốn nhiều hơn sẽ bị từ chối trước khi chạy. - Sắp ra mắt: proxy được quản lý, chế độ stealth, trình duyệt từ xa và trích xuất AI từ một prompt bằng ngôn ngữ thường. Hiện tại bạn có thể dùng proxy của riêng mình.
Câu hỏi thường gặp
Windsurf có giống Devin Desktop không?
Có. Windsurf được đổi tên thành Devin Desktop vào 2026-06-02. Đó là cùng một editor, và các bước này hoạt động cho cả hai tên.
Tôi nên thiết lập agent nào, Devin Local hay Cascade?
Devin Local là agent mặc định cho các tab mới. Cascade là agent cũ. Chúng đọc MCP server từ các tệp khác nhau, nên hãy thiết lập cái bạn dùng.
Spicrawl có tính vào giới hạn tool của Cascade không?
Có. Cascade cho phép 100 tool trên tất cả các server, và Spicrawl dùng 25. Hãy tắt các server khác nếu bạn gần chạm giới hạn.
Team của tôi chặn server. Tôi nên làm gì?
Một allowlist của team đang bật. Hãy nhờ admin thêm Server ID spicrawl vào allowlist (phân biệt hoa thường).
Mỗi trang tốn bao nhiêu?
Một lần fetch thường tốn 1 credit, render JavaScript 3 và render bằng trình duyệt đầy đủ 8. Request thất bại tốn 0. Cache hit tốn bằng với lần fetch đã lưu nó. Hãy yêu cầu agent đặt max_cost cho mỗi request để nó không bao giờ tiêu nhiều hơn bạn dự kiến.