ScrapeBox 作为本地 REST API 运行:http://localhost:8080。无需 API Key、无云依赖,数据留在本机。以下是 Python 和 Node.js 的开箱即用示例。
start.bat(Windows)或 bash start.sh(Mac/Linux),然后执行示例。import requests
r = requests.get("http://localhost:8080/text",
params={"url": "https://example.com"})
print(r.json()["data"]) # 干净的页面文本
import requests
# 页面所有链接
links = requests.get("http://localhost:8080/links",
params={"url": "https://example.com"}).json()
for link in links["data"]:
print(link["text"], "->", link["href"])
# 所有表格(行列表)
tables = requests.get("http://localhost:8080/tables",
params={"url": "https://example.com"}).json()
for row in tables["data"][0]:
print(row) # row = [cell1, cell2, ...]
const res = await fetch(
"http://localhost:8080/text?url=https://example.com"
);
const { data } = await res.json();
console.log(data); // 干净的页面文本
ScrapeBox 与 MCP 浏览器工具搭配效果最佳。参见 MCP 抓取指南 了解推荐组合。