WebUnlocker OpenClaw Skill
Use this skill to bypass website blocks and scrape web content using the Scrapeless Universal Scraping API. It supports JavaScript rendering, CAPTCHA solving, IP rotation, and intelligent request retries.
Authentication: Set X_API_TOKEN in your environment or in a .env file in the repo root.
Errors: On failure the script writes a JSON error to stderr and exits with code 1.
Usage
Command:
CODEBLOCK0
Examples:
# Scrape HTML content
python3 scripts/webunlocker.py --url "https://httpbin.io/get"
# Scrape plain text
python3 scripts/webunlocker.py --url "https://example.com" --response-type plaintext
# Scrape as Markdown
python3 scripts/webunlocker.py --url "https://example.com" --response-type markdown
# Take a screenshot
python3 scripts/webunlocker.py --url "https://example.com" --response-type png
# Capture network requests
python3 scripts/webunlocker.py --url "https://example.com" --response-type network
# Extract specific content types
python3 scripts/webunlocker.py --url "https://example.com" --response-type content --content-types emails,links,images
# Use a specific country proxy
python3 scripts/webunlocker.py --url "https://example.com" --country US
# Use POST method
python3 scripts/webunlocker.py --url "https://httpbin.org/post" --method POST --data '{"key": "value"}'
# Add custom headers
python3 scripts/webunlocker.py --url "https://example.com" --headers '{"User-Agent": "Mozilla/5.0"}'
# Use custom proxy
python3 scripts/webunlocker.py --url "https://example.com" --proxy-url "http://your-proxy-url:port"
# Enable JavaScript rendering
python3 scripts/webunlocker.py --url "https://example.com" --js-render
# Enable JavaScript rendering with headless mode
python3 scripts/webunlocker.py --url "https://example.com" --js-render --headless
# Enable JavaScript rendering and wait for specific element
python3 scripts/webunlocker.py --url "https://example.com" --js-render --wait-selector "body > div > p:nth-child(3) > a"
# Bypass Cloudflare protection with JavaScript rendering
python3 scripts/webunlocker.py --url "https://example.com" --js-render
# Bypass Cloudflare Turnstile challenge
python3 scripts/webunlocker.py --url "https://2captcha.com/demo/cloudflare-turnstile-challenge" --js-render --headless --response-type markdown
Summary
| Argument | Description | Default |
|---|
| INLINECODE2 | Target URL | Required |
| INLINECODE3 |
HTTP method | GET |
|
--redirect | Allow redirects | False |
|
--headers | Custom headers as JSON string | None |
|
--data | Request data as JSON string | None |
|
--response-type | Response type (html, plaintext, markdown, png, jpeg, network, content) | html |
|
--content-types | Content types to extract (comma-separated) | None |
|
--country | Country code for proxy | ANY |
|
--proxy-url | Custom proxy URL | None |
|
--js-render | Enable JavaScript rendering | False |
|
--headless | Run browser in headless mode | False |
|
--wait-selector | Wait for element with this selector to appear | None |
Output: All commands return JSON objects with the scraped content or Cloudflare bypass results.
Response Types
HTML
Returns the HTML content of the page as an escaped string.
Plaintext
Returns the plain text content of the page, removing all HTML tags.
Markdown
Returns the page content formatted as Markdown for better readability.
PNG/JPEG
Returns a base64 encoded string of the page screenshot.
Network
Returns all network requests made during page load, including URLs, methods, status codes, and headers.
Content
Returns specific content types extracted from the page, such as emails, phone numbers, headings, images, audios, videos, links, hashtags, metadata, tables, and favicon.
Notes
⚠️ Timeout Policy:
- - Page load timeout: 30 seconds
- Global execution timeout: 180 seconds
⚠️ Supported CAPTCHAs:
- - reCaptcha V2
- Cloudflare Turnstile
- Cloudflare Challenge
⚠️ Rate Limits:
- - 429 errors indicate rate limit exceeded. Reduce request frequency or upgrade plan.
⚠️ Billing:
- - Charges are applied on a per-request basis
- Only successful requests will be billed
WebUnlocker OpenClaw 技能
使用此技能绕过网站封锁,并通过 Scrapeless 通用抓取 API 抓取网页内容。它支持 JavaScript 渲染、验证码解决、IP 轮换和智能请求重试。
身份验证: 在环境变量或仓库根目录的 .env 文件中设置 XAPITOKEN。
错误处理: 失败时,脚本会将 JSON 错误写入 stderr 并以代码 1 退出。
使用方法
命令:
bash
python3 scripts/webunlocker.py --url https://example.com
示例:
bash
抓取 HTML 内容
python3 scripts/webunlocker.py --url https://httpbin.io/get
抓取纯文本
python3 scripts/webunlocker.py --url https://example.com --response-type plaintext
抓取为 Markdown 格式
python3 scripts/webunlocker.py --url https://example.com --response-type markdown
截取屏幕截图
python3 scripts/webunlocker.py --url https://example.com --response-type png
捕获网络请求
python3 scripts/webunlocker.py --url https://example.com --response-type network
提取特定内容类型
python3 scripts/webunlocker.py --url https://example.com --response-type content --content-types emails,links,images
使用特定国家代理
python3 scripts/webunlocker.py --url https://example.com --country US
使用 POST 方法
python3 scripts/webunlocker.py --url https://httpbin.org/post --method POST --data {key: value}
添加自定义请求头
python3 scripts/webunlocker.py --url https://example.com --headers {User-Agent: Mozilla/5.0}
使用自定义代理
python3 scripts/webunlocker.py --url https://example.com --proxy-url http://your-proxy-url:port
启用 JavaScript 渲染
python3 scripts/webunlocker.py --url https://example.com --js-render
启用 JavaScript 渲染并使用无头模式
python3 scripts/webunlocker.py --url https://example.com --js-render --headless
启用 JavaScript 渲染并等待特定元素
python3 scripts/webunlocker.py --url https://example.com --js-render --wait-selector body > div > p:nth-child(3) > a
使用 JavaScript 渲染绕过 Cloudflare 保护
python3 scripts/webunlocker.py --url https://example.com --js-render
绕过 Cloudflare Turnstile 验证
python3 scripts/webunlocker.py --url https://2captcha.com/demo/cloudflare-turnstile-challenge --js-render --headless --response-type markdown
参数汇总
| 参数 | 描述 | 默认值 |
|---|
| --url | 目标 URL | 必填 |
| --method |
HTTP 方法 | GET |
| --redirect | 允许重定向 | False |
| --headers | 自定义请求头(JSON 字符串) | None |
| --data | 请求数据(JSON 字符串) | None |
| --response-type | 响应类型(html, plaintext, markdown, png, jpeg, network, content) | html |
| --content-types | 要提取的内容类型(逗号分隔) | None |
| --country | 代理国家代码 | ANY |
| --proxy-url | 自定义代理 URL | None |
| --js-render | 启用 JavaScript 渲染 | False |
| --headless | 以无头模式运行浏览器 | False |
| --wait-selector | 等待指定选择器的元素出现 | None |
输出: 所有命令返回包含抓取内容或 Cloudflare 绕过结果的 JSON 对象。
响应类型
HTML
返回页面的 HTML 内容,以转义字符串形式呈现。
Plaintext
返回页面的纯文本内容,移除所有 HTML 标签。
Markdown
返回格式化为 Markdown 的页面内容,提高可读性。
PNG/JPEG
返回页面截图的 base64 编码字符串。
Network
返回页面加载期间的所有网络请求,包括 URL、方法、状态码和请求头。
Content
返回从页面提取的特定内容类型,如电子邮件、电话号码、标题、图片、音频、视频、链接、话题标签、元数据、表格和网站图标。
注意事项
⚠️ 超时策略:
- - 页面加载超时:30 秒
- 全局执行超时:180 秒
⚠️ 支持的验证码:
- - reCaptcha V2
- Cloudflare Turnstile
- Cloudflare Challenge
⚠️ 速率限制:
- - 429 错误表示超出速率限制。请降低请求频率或升级套餐。
⚠️ 计费: