网页阅读
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/reader \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://www.example.com"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/reader"
payload = { "url": "https://www.example.com" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://www.example.com'})
};
fetch('https://open.bigmodel.cn/api/paas/v4/reader', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/reader")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://www.example.com\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/reader"
payload := strings.NewReader("{\n \"url\": \"https://www.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/reader",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://www.example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"model": "<string>",
"reader_result": {
"content": "<string>",
"description": "<string>",
"title": "<string>",
"url": "<string>",
"external": {
"stylesheet": {}
},
"metadata": {
"keywords": "<string>",
"viewport": "<string>",
"description": "<string>",
"format-detection": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}工具 API
网页阅读
读取并解析指定 URL 的网页内容,可选择返回格式、支持控制缓存、图片保留与摘要选项等。点击 Try it 按钮可快速试用。
POST
/
paas
/
v4
/
reader
网页阅读
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/reader \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://www.example.com"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/reader"
payload = { "url": "https://www.example.com" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://www.example.com'})
};
fetch('https://open.bigmodel.cn/api/paas/v4/reader', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/reader")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://www.example.com\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/reader"
payload := strings.NewReader("{\n \"url\": \"https://www.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/reader",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://www.example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"model": "<string>",
"reader_result": {
"content": "<string>",
"description": "<string>",
"title": "<string>",
"url": "<string>",
"external": {
"stylesheet": {}
},
"metadata": {
"keywords": "<string>",
"viewport": "<string>",
"description": "<string>",
"format-detection": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Body
application/json
需要抓取的url
请求超时时间(秒),默认值 20
是否禁用缓存(true/false),默认值 false
返回格式(如:markdown、text等),默认值 markdown
是否保留图片(true/false),默认值 true
是否禁用 GitHub Flavored Markdown(true/false),默认值 false
是否保留图片数据 URL(true/false),默认值 false
是否包含图片摘要(true/false),默认值 false
是否包含链接摘要(true/false),默认值 false
Was this page helpful?
⌘I