web-fetch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWeb Fetch Skill
Web Fetch 技能
Fetch web content. Prefer the built-in WebFetch tool — it uses a real browser engine for JavaScript-rendered pages with high success rate. Fall back to curl only if WebFetch is unavailable.
获取网页内容。优先使用内置的WebFetch工具——它使用真实浏览器引擎处理JavaScript渲染的页面,成功率高。仅当WebFetch不可用时,才退而使用curl。
Fetch a Web Page (HTML → Text)
获取网页内容(HTML → 文本)
bash
undefinedbash
undefinedGet page content, strip HTML tags, first 500 lines
获取页面内容,去除HTML标签,取前500行
curl -sL "URL" | sed 's/<[^>]*>//g' | sed '/^$/d' | head -500
curl -sL "URL" | sed 's/<[^>]*>//g' | sed '/^$/d' | head -500
Or use lynx for better text extraction (if installed)
或者使用lynx进行更优的文本提取(需已安装)
lynx -dump -nolist "URL" | head -500
lynx -dump -nolist "URL" | head -500
Or use w3m
或者使用w3m
w3m -dump "URL" | head -500
undefinedw3m -dump "URL" | head -500
undefinedFetch JSON API
获取JSON API内容
bash
curl -s "https://api.example.com/data" | jq '.'bash
curl -s "https://api.example.com/data" | jq '.'Fetch with Headers
携带请求头获取内容
bash
undefinedbash
undefinedWith custom headers
携带自定义请求头
curl -s -H "Authorization: Bearer TOKEN" -H "Accept: application/json" "URL"
curl -s -H "Authorization: Bearer TOKEN" -H "Accept: application/json" "URL"
With user agent
携带用户代理
curl -sL -A "Mozilla/5.0" "URL"
undefinedcurl -sL -A "Mozilla/5.0" "URL"
undefinedDownload Files
下载文件
bash
undefinedbash
undefinedDownload to specific path
下载到指定路径
curl -sL -o /tmp/file.pdf "URL"
curl -sL -o /tmp/file.pdf "URL"
Download with original filename
以原始文件名下载
curl -sLOJ "URL"
undefinedcurl -sLOJ "URL"
undefinedCheck URL Status
检查URL状态
bash
undefinedbash
undefinedJust get HTTP status code
仅获取HTTP状态码
curl -sL -o /dev/null -w "%{http_code}" "URL"
curl -sL -o /dev/null -w "%{http_code}" "URL"
Get headers only
仅获取响应头
curl -sI "URL"
undefinedcurl -sI "URL"
undefinedTips
小贴士
- Use for silent mode + follow redirects
-sL - Pipe to to limit output and avoid context overflow
head -N - For large pages, extract just what you need with or
grepsed - Use for JSON responses
jq - Some sites block curl — add a browser User-Agent with
-A
- 使用 参数启用静默模式并跟随重定向
-sL - 通过管道传递给 来限制输出,避免内容溢出
head -N - 对于大页面,使用 或
grep仅提取所需内容sed - 使用 处理JSON响应
jq - 部分网站会拦截curl请求——使用 参数添加浏览器用户代理
-A