Zhipu Web Page Reader
Fetch and parse web page content via Zhipu AI's Reader API (/paas/v4/reader), using lightweight cURL. Returns parsed page content in Markdown or plain text format, along with metadata like title and description.
Quick Start
Basic cURL Usage
CODEBLOCK0
Script Usage
A wrapper shell script is provided for convenience.
CODEBLOCK1
API Parameter Reference
| Parameter | Type | Required | Default | Description |
|---|
| INLINECODE2 | string | ✅ | - | URL of the web page to fetch |
| INLINECODE3 |
integer | - |
20 | Request timeout in seconds |
|
no_cache | boolean | - |
false | Disable caching (
true/
false) |
|
return_format | string | - |
markdown | Return format:
markdown or
text |
|
retain_images | boolean | - |
true | Retain images in output (
true/
false) |
|
no_gfm | boolean | - |
false | Disable GitHub Flavored Markdown (
true/
false) |
|
keep_img_data_url | boolean | - |
false | Keep image data URLs (
true/
false) |
|
with_images_summary | boolean | - |
false | Include images summary (
true/
false) |
|
with_links_summary | boolean | - |
false | Include links summary (
true/
false) |
Response Structure
The API returns JSON with the parsed page content.
CODEBLOCK2
Key Response Fields
| Field | Description |
|---|
| INLINECODE33 | Main parsed content (body text, images, links) |
| INLINECODE34 |
Page title |
|
reader_result.description | Brief page description |
|
reader_result.url | Original page URL |
|
reader_result.metadata | Page metadata (keywords, viewport, etc.) |
Common Use Cases
| Scenario | Command |
|---|
| Read a documentation page | INLINECODE38 |
| Extract text only (no images) |
--url <url> --no-images --format text |
| Force fresh fetch (bypass cache) |
--url <url> --no-cache |
| Get content with all summaries |
--url <url> --images-summary --links-summary |
| Long page with extended timeout |
--url <url> --timeout 60 |
Environment Requirements
- - Environment variable
ZHIPU_API_KEY must be configured. - INLINECODE44 command must be available in your system path.
技能名称: zhipu-web-fetch
详细描述:
智谱网页阅读器
通过智谱AI的Reader API(/paas/v4/reader)获取并解析网页内容,使用轻量级cURL。返回Markdown或纯文本格式的解析后页面内容,以及标题和描述等元数据。
快速开始
基础cURL用法
bash
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/reader \
--header Authorization: Bearer $ZHIPUAPIKEY \
--header Content-Type: application/json \
--data {
url: https://www.example.com
}
脚本用法
为方便使用,提供了一个封装好的Shell脚本。
bash
基础获取(默认返回Markdown格式)
bash scripts/zhipu_fetch.sh --url https://www.example.com
获取纯文本格式,不使用缓存
bash scripts/zhipu_fetch.sh \
--url https://docs.python.org/3/ \
--format text \
--no-cache
获取内容并包含图片和链接摘要
bash scripts/zhipu_fetch.sh \
--url https://news.example.com/article \
--images-summary \
--links-summary
获取内容时不包含图片,禁用GFM
bash scripts/zhipu_fetch.sh \
--url https://blog.example.com/post \
--no-images \
--no-gfm
API参数参考
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|
| url | 字符串 | ✅ | - | 要获取的网页URL |
| timeout |
整数 | - | 20 | 请求超时时间(秒) |
| no_cache | 布尔值 | - | false | 禁用缓存(true/false) |
| return_format | 字符串 | - | markdown | 返回格式:markdown或text |
| retain_images | 布尔值 | - | true | 在输出中保留图片(true/false) |
| no_gfm | 布尔值 | - | false | 禁用GitHub风格的Markdown(true/false) |
| keep
imgdata_url | 布尔值 | - | false | 保留图片数据URL(true/false) |
| with
imagessummary | 布尔值 | - | false | 包含图片摘要(true/false) |
| with
linkssummary | 布尔值 | - | false | 包含链接摘要(true/false) |
响应结构
API返回包含解析后页面内容的JSON。
json
{
id: task-id,
created: 1704067200,
request_id: request-id,
model: model-name,
reader_result: {
title: 页面标题,
description: 页面简要描述,
url: https://www.example.com,
content: 解析后的页面内容(Markdown或文本),
external: {
stylesheet: {}
},
metadata: {
keywords: 页面, 关键词,
viewport: width=device-width,
description: 元描述,
format-detection: telephone=no
}
}
}
关键响应字段
| 字段 | 描述 |
|---|
| readerresult.content | 主要解析内容(正文文本、图片、链接) |
| readerresult.title |
页面标题 |
| reader_result.description | 页面简要描述 |
| reader_result.url | 原始页面URL |
| reader_result.metadata | 页面元数据(关键词、视口等) |
常见使用场景
| 场景 | 命令 |
|---|
| 阅读文档页面 | --url <文档URL> |
| 仅提取文本(无图片) |
--url
--no-images --format text |
| 强制刷新获取(绕过缓存) | --url --no-cache |
| 获取包含所有摘要的内容 | --url --images-summary --links-summary |
| 长页面并延长超时时间 | --url --timeout 60 |
环境要求
- - 必须配置环境变量ZHIPUAPIKEY。
- 系统路径中必须可用curl命令。