Borrowing it
Nothing to install: this file belongs to xilu0/awesome-claude-code. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/xilu0/awesome-claude-code/main/.claude/commands/fetch-webpage.mdgit clone --depth 1 https://github.com/xilu0/awesome-claude-codeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/xilu0/awesome-claude-code/fetch-webpage)<a href="https://agentmods.dev/commands/xilu0/awesome-claude-code/fetch-webpage"><img src="https://agentmods.dev/badge/commands/xilu0/awesome-claude-code/fetch-webpage/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/xilu0/awesome-claude-code/fetch-webpage"><img src="https://agentmods.dev/badge/commands/xilu0/awesome-claude-code/fetch-webpage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01905 |
| Opus 5.5 | $0.00000 | $0.00762 |
| Sonnet 5.5 | $0.00000 | $0.00381 |
| Haiku 4.5 | $0.00000 | $0.00191 |
Grade A, and why
fetch-webpage scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -o public/images/[目录名]/[文章名]/[图片名] [图片URL] Copies of this mod
1 near-identical copy found in the catalogue:
- fetch-webpage — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.
抓取网页内容并保存到项目
使用 Chrome DevTools MCP 抓取指定网页的内容,包括文本和图片,保存到本项目中。
参数
- URL: $ARGUMENTS (必填,要抓取的网页地址)
- 保存目录: 请在执行时询问用户
工具说明
| 工具 | 返回内容 | 用途 |
|---|---|---|
take_snapshot |
基于 A11y 树的文本结构 + 元素 uid | 快速了解页面结构、定位元素 |
take_screenshot |
PNG/JPEG 图片 | 视觉截图 |
evaluate_script |
自定义 JS 返回值 | 提取 DOM、执行操作、分段加载大页面 |
关键特性:take_snapshot 和 take_screenshot 都支持 filePath 参数,可将内容保存到临时文件,然后使用 Read 工具分段加载。
执行步骤
1. 导航到目标页面
mcp__chrome-devtools__navigate_page({ type: "url", url: "目标URL" })
2. 检测页面大小
使用 evaluate_script 检测页面规模,决定是否需要分段提取:
mcp__chrome-devtools__evaluate_script({
function: `() => ({
totalHeight: document.documentElement.scrollHeight,
textLength: document.body.innerText.length,
sectionsCount: document.querySelectorAll('section, article, .content, main').length,
imagesCount: document.querySelectorAll('img').length
})`
})
判断标准:
- 文本长度 < 10000 字符 → 小页面,直接提取
- 文本长度 >= 10000 字符 → 大页面,分段提取或使用临时文件
3. 获取页面结构概览
方式 A:直接获取(小页面)
mcp__chrome-devtools__take_snapshot()
用于快速了解页面结构,但注意 snapshot 有 ~25000 令牌限制,超大页面可能报错。
方式 B:保存到临时文件后分段读取(大页面,推荐)
# 步骤 1:保存 snapshot 到临时文件
mcp__chrome-devtools__take_snapshot({ filePath: "/tmp/page-snapshot.txt" })
# 步骤 2:分段读取文件内容
Read(file_path: "/tmp/page-snapshot.txt", limit: 500) # 前 500 行
Read(file_path: "/tmp/page-snapshot.txt", offset: 500, limit: 500) # 500-1000 行
Read(file_path: "/tmp/page-snapshot.txt", offset: 1000, limit: 500) # 1000-1500 行
# 继续按需读取...
临时文件方式的优势:
- 避免单次返回内容过大导致超时或截断
- 可以按需读取特定部分,节省 token
- 文件可复用,多次查阅无需重新抓取
4. 提取页面内容
小页面(< 10000 字符):直接提取
mcp__chrome-devtools__evaluate_script({
function: `() => ({
title: document.title,
content: document.body.innerText,
images: Array.from(document.querySelectorAll('img')).map(img => ({
src: img.src,
alt: img.alt
}))
})`
})
大页面(>= 10000 字符):多种分段策略
方案 A:保存到临时文件后分段读取(推荐)
// 步骤 1:将完整内容保存到临时文件
mcp__chrome-devtools__evaluate_script({
function: `() => {
const content = {
title: document.title,
url: window.location.href,
content: document.body.innerText,
html: document.body.innerHTML
};
return JSON.stringify(content, null, 2);
}`
})
// 将返回的 JSON 内容写入临时文件
Write(file_path: "/tmp/page-content.json", content: "上面返回的内容")
// 步骤 2:分段读取
Read(file_path: "/tmp/page-content.json", limit: 300)
Read(file_path: "/tmp/page-content.json", offset: 300, limit: 300)
// 继续按需读取...
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 219 lines · 0 tokens per session scan A 01253976443b
fetch-webpage is a command published in the GitHub repository xilu0/awesome-claude-code (4 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,905 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
fetch-webpage compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| fetch-webpagexilu0/awesome-claude-code | Command | 4 | 8mo ago | MIT | A | 0 | Claude Code |
| auto-browsemarcusquinn/aidevops | Command | 439 | today | MIT | A | 18 | Claude Code |
| webapp-testinghamr0/agentic-toolkit | Command | 23 | 6d ago | Apache-2.0 | A | 35 | Claude Code |
| verify-prdesplega-ai/qa-use | Command | 29 | 1mo ago | MIT | A | 0 | Claude Code |
| gh-issue-use-cypressskyfox675/agents-skills | Command | 11 | today | MIT | A | 49 | Claude Code |
| readinesscygaco/master-console | Command | 111 | 17d ago | AGPL-3.0 | A | 51 | Claude Code |
| can-i-useivklgn/ai-kit | Command | 12 | 1mo ago | MIT | A | 13 | Claude Code |