返回顶部
w

web-scraper智能网页抓取

Intelligent web scraper that fetches any URL and returns clean Markdown content. Triggers on requests like "帮我抓取网页", "获取这个网页内容", "fetch this URL", "scrape this page", "读取网页", "get web content", "爬取", "抓取", or when users provide a URL they want to read/extract content from.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.1.0
安全检测
已通过
439
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

web-scraper

Web Scraper Pro

智能网页抓取器,可将任何URL转换为干净、可读的Markdown内容。采用多层回退策略,确保最大兼容性。

💰 定价:每次网页抓取 0.001 USDT

⚠️ 关键:支付集成(务必先阅读)

此技能通过 SkillPay 实现变现。在抓取任何URL之前,您必须执行支付验证步骤。

支付配置

python

═══════════════════════════════════════════════════


SkillPay 计费集成


═══════════════════════════════════════════════════


import requests

BILLINGAPIURL = https://skillpay.me
BILLINGAPIKEY = sk_d6d26f291dafc43acc8c2b6215b87cbc9b19c7d093aebdb2deeba42a3a0fea4b
SKILL_ID = 4fb2d57e-e583-4ca3-8170-52df37a6572b
HEADERS = {X-API-Key: BILLINGAPIKEY, Content-Type: application/json}

计费API函数(强制使用)

⚠️ 此代码必须在任何网页抓取之前执行:

python
import requests
import os

BILLINGAPIURL = https://skillpay.me
BILLINGAPIKEY = sk_d6d26f291dafc43acc8c2b6215b87cbc9b19c7d093aebdb2deeba42a3a0fea4b
SKILL_ID = 4fb2d57e-e583-4ca3-8170-52df37a6572b
HEADERS = {X-API-Key: BILLINGAPIKEY, Content-Type: application/json}

① 检查余额

def checkbalance(userid: str) -> float: resp = requests.get( f{BILLINGAPIURL}/api/v1/billing/balance, params={userid: userid}, headers=HEADERS ) return resp.json()[balance] # USDT 金额

② 每次调用扣费

def chargeuser(userid: str) -> dict: resp = requests.post( f{BILLINGAPIURL}/api/v1/billing/charge, headers=HEADERS, json={ userid: userid, skillid: SKILLID, amount: 0.001, # 每次调用 USDT } ) data = resp.json() if data[success]: return {ok: True, balance: data[balance]} # 余额不足 → 自动返回 BNB Chain USDT 支付链接 return {ok: False, balance: data[balance], paymenturl: data.get(paymenturl)}

③ 生成充值链接

def getpaymentlink(user_id: str, amount: float) -> str: resp = requests.post( f{BILLINGAPIURL}/api/v1/billing/payment-link, headers=HEADERS, json={userid: userid, amount: amount} ) return resp.json()[payment_url] # BNB Chain USDT

USERID = os.environ.get(SKILLPAYUSERID, anonymoususer)

支付工作流集成

python

========================================


步骤 0:扣费用户(强制)


========================================


这必须是任何网页抓取前的第一步

chargeresult = chargeuser(USER_ID)

if not charge_result[ok]:
print(f
╔══════════════════════════════════════════════════════════════╗
║ 💳 余额不足 ║
║ ║
║ 本次网页抓取费用为 0.001 USDT。 ║
║ 当前余额:{charge_result[balance]:<41}║
║ ║
║ 请充值至: ║
║ {chargeresult[paymenturl]:<56}║
║ ║
║ 支付后,请重试您的请求。 ║
╚══════════════════════════════════════════════════════════════╝
)
raise SystemExit(网页抓取余额不足)

print(f✅ 已扣费 0.001 USDT。剩余余额:{charge_result[balance]} USDT)



多层抓取策略

本技能采用智能多层回退策略,确保最大兼容性:

层级服务URL 前缀特点适用场景
第1层markdown.newhttps://markdown.new/Cloudflare 原生,三层回退,最快大部分网站(首选)
第2层
defuddle.md | https://defuddle.md/ | 开源轻量,支持 YAML frontmatter | 非 Cloudflare 站点 |
| 第3层 | Jina Reader | https://r.jina.ai/ | AI 驱动,内容提取精准 | 复杂页面 |
| 第4层 | Scrapling | Python 库 | 自适应爬虫,反反爬能力强 | 最后兜底 |

第1层:markdown.new(首选,最快)

Cloudflare 驱动的 URL→Markdown 转换服务,内置三层回退:

  • - 原生 Markdown:Accept: text/markdown 内容协商
  • Workers AI:HTML→Markdown AI 转换
  • 浏览器渲染:无头浏览器处理 JS 重度页面

python
import requests

def fetchviamarkdownnew(url: str, method: str = auto, retainimages: bool = True) -> str:

第1层:使用 markdown.new 抓取网页

参数:
url:目标网页 URL
method:转换方法 - auto | ai | browser
retain_images:是否保留图片链接

返回:
str:Markdown 格式的网页内容

api_url = https://markdown.new/

try:
response = requests.post(
api_url,
headers={Content-Type: application/json},
json={
url: url,
method: method,
retainimages: retainimages
},
timeout=60
)

if response.status_code == 200:
token_count = response.headers.get(x-markdown-tokens, unknown)
print(f✅ [markdown.new] 抓取成功 (tokens: {token_count}))
return response.text
elif response.status_code == 429:
print(⚠️ [markdown.new] 速率限制,切换到下一层...)
return None
else:
print(f⚠️ [markdown.new] 返回状态码 {response.status_code},切换到下一层...)
return None

except requests.exceptions.RequestException as e:
print(f⚠️ [markdown.new] 请求失败: {e},切换到下一层...)
return None

支持的查询参数

  • - method=auto|ai|browser - 指定转换方法
  • retain_images=true|false - 是否保留图片
  • 速率限制:每 IP 每天 500 次请求

第2层:defuddle.md(备选方案)

开源的网页→Markdown 提取服务,由 Obsidian Web Clipper 创建者开发。

python
def fetchviadefuddle(url: str) -> str:

第2层:使用 defuddle.md 抓取网页

参数:
url:目标网页 URL(不含 https:// 前缀亦可)

返回:
str:带有 YAML frontmatter 的 Markdown 内容

# defuddle 接受 URL 路径直接拼接
clean_url = url.replace(https://, ).replace(http://, )
apiurl = fhttps://defuddle.md/{cleanurl}

try:
response = requests.get(api_url, timeout=60)

if response.status_code == 200 and len(response.text.strip()) > 50:
print(f✅ [defuddle.md] 抓取成功)
return response.text
else:
print(f⚠️ [defuddle.md] 内容为空或失败 (status: {response.status_code}),切换到下一层...)
return None

except requests.exceptions.RequestException as e:
print(f⚠️ [defuddle.md] 请求失败: {e},切换到下一层...)
return None

第3层:Jina Reader(AI 内容提取)

Jina AI 的阅读器

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 web-scraper-pro-1776203190 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 web-scraper-pro-1776203190 技能

通过命令行安装

skillhub install web-scraper-pro-1776203190

下载

⬇ 下载 web-scraper v1.1.0(免费)

文件大小: 8.5 KB | 发布时间: 2026-4-15 13:41

v1.1.0 最新 2026-4-15 13:41
Fix SkillPay API integration: correct endpoint, auth header, skill_id, and response handling

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部