web-fetch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web Fetch

网页内容获取与提取

Fetch and extract readable content from web pages using curl and basic text processing.
使用curl和基础文本处理从网页中获取并提取可读内容。

Usage

使用方法

Important: Scripts are located relative to this skill's base directory.
When you see this skill in
<available_skills>
, note the
<base_dir>
path.
bash
undefined
重要提示:脚本位于本技能的基础目录下。
当你在
<available_skills>
中看到本技能时,请留意
<base_dir>
路径。
bash
undefined

General pattern:

通用格式:

bash "<base_dir>/scripts/fetch.sh" <url> [output_file]
bash "<base_dir>/scripts/fetch.sh" <url> [output_file]

Example (replace <base_dir> with actual path from skill listing):

示例(将<base_dir>替换为技能列表中的实际路径):

bash "~/chatgpt-on-wechat/skills/web-fetch/scripts/fetch.sh" "https://example.com"

**Parameters:**
- `url`: The HTTP/HTTPS URL to fetch (required)
- `output_file`: Optional file to save the output (default: stdout)

**Returns:**
- Extracted page content with title and text
bash "~/chatgpt-on-wechat/skills/web-fetch/scripts/fetch.sh" "https://example.com"

**参数说明:**
- `url`:要获取的HTTP/HTTPS网址(必填)
- `output_file`:用于保存输出的可选文件(默认输出到标准输出stdout)

**返回结果:**
- 提取的包含标题和文本的页面内容

Examples

示例

Fetch a web page

抓取网页

bash
bash "<base_dir>/scripts/fetch.sh" "https://example.com"
bash
bash "<base_dir>/scripts/fetch.sh" "https://example.com"

Save to file

保存到文件

bash
bash "<base_dir>/scripts/fetch.sh" "https://example.com" output.txt
cat output.txt
bash
bash "<base_dir>/scripts/fetch.sh" "https://example.com" output.txt
cat output.txt

Notes

注意事项

  • Uses curl for HTTP requests (timeout: 10s)
  • Extracts title and basic text content
  • Removes HTML tags and scripts
  • Works with any standard web page
  • No external dependencies beyond curl
  • 使用curl发送HTTP请求(超时时间:10秒)
  • 提取标题和基础文本内容
  • 移除HTML标签和脚本
  • 适用于任何标准网页
  • 除curl外无其他外部依赖