HTML-to-Selenium
分析网页HTML结构并生成Selenium自动化脚本,适用于网页元素识别与控制。
通过自然语言指令实现无阻抗网页抓取与数据提取。
openclaw skills install @ai-mrscraper/mrscraper命令、参数、文件名以原文为准
通过 MrScraper API,使用自然语言指令实现 AI 驱动、免封锁的网页抓取与数据提取。
本技能支持以下功能:
该技能为纯 API 接口调用,不依赖本地脚本。
https://api.mrscraper.comhttps://api.app.mrscraper.com所有接口均使用头部认证:
x-api-token: <MRSCRAPER_API_TOKEN>
accept: application/json
content-type: application/jsonMRSCRAPER_API_TOKEN?API 密钥允许您的应用安全地与 MrScraper API 交互,并重跑仪表板中创建的抓取任务。
请按以下步骤在仪表板中操作:
MRSCRAPER_API_TOKEN。x-api-token 头部使用该密钥。安全提示:
备注:
sync.scraper.mrscraper.com 上的接口。support@mrscraper.com。scripts/ 目录。api.app.mrscraper.com 和 api.mrscraper.com。GEThttps://api.mrscraper.comx-api-token 头部通过隐蔽浏览和 IP 轮换打开目标网址,返回 HTML 内容。适用于因验证码或反机器人机制而无法直接访问的页面。
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
url | string | 是 | — | 已 URL 编码的目标网址 |
timeout | number | 否 | 60 | 最大等待时间(秒),例如 120 |
geoCode | string | 否 | 无 | 地理路由代码,例如 SG |
blockResources | boolean | 否 | false | 是否阻止非必要资源加载 |
curl --location 'https://api.mrscraper.com?timeout=120&geoCode=SG&url=https%3A%2F%2Fwww.lazada.sg%2Fproducts%2Fpdp-i111650098-s23209659764.html&blockResources=false' \
-H "x-api-token: <MRSCRAPER_API_TOKEN>"<!doctype html>
<html>
<head>...</head>
<body>...</body>
</html>geoCode 和合理的超时时间。POSThttps://api.app.mrscraper.com/api/v1/scrapers-aix-api-token根据自然语言指令创建新的 AI 抓取任务。
agent: general 或 agent: listing):| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
url | string | 是 | — | 目标网址 |
message | string | 是 | — | 数据提取指令 |
agent | string | 否 | general | AI 抓取代理类型:general、listing 或 map |
proxyCountry | string | 否 | 无 | 用于代理抓取的 ISO 国家代码 |
map 代理专用参数:| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
url | string | 是 | — | 目标网址 |
agent | string | 否 | map | 代理类型,此处固定为 map |
maxDepth | number | 否 | 2 | 最大爬取深度。<br>0 = 仅起始页面,1 = 加上直接链接 |
maxPages | number | 否 | 50 | 整个爬取过程中最多抓取的页面数 |
limit | number | 否 | 1000 | 所有页面中最多提取的数据记录数。达到上限后停止抓取 |
includePatterns | string | 否 | "" | 正则模式,用于包含特定路径(多个用 `\ |
excludePatterns | string | 否 | "" | 正则模式,用于排除特定路径(多个用 `\ |
curl -X POST "https://api.app.mrscraper.com/api/v1/scrapers-ai" \
-H "x-api-token: <MRSCRAPER_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
"message": "提取标题、价格、库存和评分",
"agent": "general"
}'{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"createdAt": "2019-08-24T14:15:22Z",
"createdById": "e13e432a-5323-4484-a91d-b5969bc564d9",
"updatedAt": "2019-08-24T14:15:22Z",
"updatedById": "d8bc6076-4141-4a88-80b9-0eb31643066f",
"deletedAt": "2019-08-24T14:15:22Z",
"deletedById": "8ef578ad-7f1e-4656-b48b-b1b4a9aaa1cb",
"userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"type": "AI",
"url": "http://example.com",
"status": "Finished",
"error": "string",
"tokenUsage": 0,
"runtime": 0,
"data": {}, // 主要抓取数据
"htmlPath": "string",
"recordingPath": "string",
"screenshotPath": "string",
"dataPath": "string"
} - general:适用于大多数标准网页抓取任务,若未指定或 LLM 不确定页面类型时推荐使用。
- listing:适用于商品列表、职位列表等页面,当 LLM 能够准确识别为列表页时使用。
- map:用于网站级爬取,获取主域名下的所有子页面或子域。当用户指定的是网站而非具体页面时使用。
map 代理,可通过以下参数控制爬取行为: - maxDepth:建议值 1–2(聚焦抓取),最大推荐 3。
- maxPages:限制总页面数,不受深度影响。
- limit:限制总数据条数。
- includePatterns / excludePatterns:使用正则表达式(以 \|\| 分隔)指定包含或排除的路径,例如 */products/*||*/blog/* 或 */cart/*||*.pdf。
- 若 includePatterns 为空,则默认包含所有路径;若 excludePatterns 为空,则不排除任何路径。
POSThttps://api.app.mrscraper.com/api/v1/scrapers-ai-rerunx-api-token基于已有抓取配置,在新 URL 上重新执行。
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
scraperId | string | 是 | — | 从创建的 AI 抓取任务中获取的 ID |
url | string | 是 | — | 目标网址 |
map 代理可选参数:| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
maxDepth | number | 否 | 2 | 爬取深度 |
maxPages | number | 否 | 50 | 最多爬取页面数 |
limit | number | 否 | 1000 | 结果数量上限 |
includePatterns | string | 否 | "" | 包含路径的正则模式(用 `\ |
excludePatterns | string | 否 | "" | 排除路径的正则模式(用 `\ |
curl -X POST "https://api.app.mrscraper.com/api/v1/scrapers-ai-rerun" \
-H "accept: application/json" \
-H "x-api-token: <MRSCRAPER_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"url": "https://shopee.sg/"
}'{
"message": "Successful operation!",
"data": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"createdAt": "2019-08-24T14:15:22Z",
"createdById": "e13e432a-5323-4484-a91d-b5969bc564d9",
"updatedAt": "2019-08-24T14:15:22Z",
"updatedById": "d8bc6076-4141-4a88-80b9-0eb31643066f",
"deletedAt": "2019-08-24T14:15:22Z",
"deletedById": "8ef578ad-7f1e-4656-b48b-b1b4a9aaa1cb",
"userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"type": "Rerun-AI",
"url": "http://example.com",
"status": "Finished",
"error": "string",
"tokenUsage": 0,
"runtime": 0,
"data": {}, // 主要抓取数据
"htmlPath": "string",
"recordingPath": "string",
"screenshotPath": "string",
"dataPath": "string",
"htmlContent": "string"
}
}POSThttps://api.app.mrscraper.com/api/v1/scrapers-ai-rerun/bulkx-api-token在一个抓取配置下,对多个 URL 执行重跑。
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
scraperId | string | 是 | — | 已存在的 AI 抓取配置 ID |
urls | array[string] | 是 | — | 要运行的多个目标网址 |
curl -X POST "https://api.app.mrscraper.com/api/v1/scrapers-ai-rerun/bulk" \
-H "x-api-token: " \
-H "Content-Type: application/json" \
-d '{
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"urls": [
"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
"https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html",
"https://books.toscrape.com/catalogue/soumission_998/index.html"
]
}'{
"message": "Bulk rerun started successfully",
"data": {
"bulkResultId": "f89f8f58-3c9a-42e5-a72e-59fa6c389f09",
"status": "Running",
"totalUrls": 3
}
}POSThttps://api.app.mrscraper.com/api/v1/scrapers-manual-rerunx-api-token使用手动浏览器工作流执行重跑。
在调用此接口前,需先在仪表板中创建并保存一个手动抓取任务。操作步骤如下:
MrScraper 仪表板,进入 Scraper。新建手动抓取 +。输入、点击、延迟、提取、注入 JavaScript)。查询分页、目录分页 或 下一页链接。scraperId 用于后续 API 调用。| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
scraperId | string | 是 | — | 要重跑的手动抓取任务 ID |
url | string | 是 | — | 本次重跑的目标网址 |
workflow | array<object> | 否 | 无 | 可覆盖保存的工作流步骤。默认使用创建时保存的流程 |
curl -X POST "https://api.app.mrscraper.com/api/v1/scrapers-manual-rerun" \
-H "accept: application/json" \
-H "x-api-token: " \
-H "Content-Type: application/json" \
-d '{
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"url": "https://books.toscrape.com/",
"workflow": [
{
"type": "extract",
"data": {
"extraction_type": "text",
"attribute": null,
"name": "book",
"selector": "h3 a"
}
}
],
"record": false,
"paginator": {
"type": "query_pagination",
"max_page": 1,
"enabled": false
}
}'{
"message": "Successful operation!",
"data": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"createdAt": "2019-08-24T14:15:22Z",
"createdById": "e13e432a-5323-4484-a91d-b5969bc564d9",
"updatedAt": "2019-08-24T14:15:22Z",
"updatedById": "d8bc6076-4141-4a88-80b9-0eb31643066f",
"deletedAt": "2019-08-24T14:15:22Z",
"deletedById": "8ef578ad-7f1e-4656-b48b-b1b4a9aaa1cb",
"userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b",
"scraperId": "6695bf87-aaa6-46b0-b1ee-88586b222b0b",
"type": "Rerun-AI",
"url": "http://example.com",
"status": "Finished",
"error": "string",
"tokenUsage": 0,
"runtime": 0,
"data": {},
"htmlPath": "string",
"recordingPath": "string",
"screenshotPath": "string",
"dataPath": "string",
"htmlContent": "string"
}
}已收录 1 个 Skill