跳转到主要内容
POST
/
web_fetch
网页读取接口
curl --request POST \
  --url https://geekai.co/api/v1/web_fetch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://www.example.com",
  "model": "jina-reader-v1",
  "engine": "direct",
  "response_format": "markdown",
  "timeout": 10,
  "budget_tokens": 200000,
  "target_selectors": [
    "#main-content",
    ".article-body"
  ],
  "wait_for_selectors": [
    "#main-content",
    ".article-body"
  ],
  "remove_selectors": [
    ".advertisement",
    ".sponsored"
  ],
  "openai_compatible": false,
  "remove_images": false,
  "with_links": false,
  "with_images": false,
  "with_images_alt": false,
  "with_iframes": false
}
'
{
  "id": "<string>",
  "created": 123,
  "result": {
    "url": "<string>",
    "title": "<string>",
    "content": "<string>",
    "screenshot": "<string>",
    "links": {},
    "images": {},
    "metadata": {}
  },
  "usage": {
    "total_tokens": 1024,
    "completion_tokens": 1024
  }
}
网页读取 API 是一个专为大模型设计的网页读取工具,可以返回更适合大模型处理的结果(包含网页标题、内容、摘要等信息)。支持多个读取引擎以及多种内容格式输出。

授权

Authorization
string
header
必填

API认证token

请求体

application/json
url
string
必填

网页URL

示例:

"https://www.example.com"

model
string
默认值:jina-reader-v1

网页读取模型

engine
enum<string>
默认值:direct

读取引擎,不同平台支持的读取引擎可能不一样,direct 表示速度优先,browser 表示质量优先

可用选项:
direct,
browser
response_format
enum<string>
默认值:markdown

返回内容格式

可用选项:
markdown,
html,
text,
screenshot
timeout
integer
默认值:10

请求超时时间,单位为秒

budget_tokens
integer
默认值:200000

预算token数

target_selectors
string[]

仅提取指定 CSS 选择器内容

示例:
["#main-content", ".article-body"]
wait_for_selectors
string[]

等待指定 CSS 选择器加载后再进行内容提取

示例:
["#main-content", ".article-body"]
remove_selectors
string[]

提取内容时排除指定 CSS 选择器

示例:
[".advertisement", ".sponsored"]
openai_compatible
boolean
默认值:false

是否返回OpenAI兼容格式的内容,默认为false

remove_images
boolean
默认值:false

是否移除内容中的图片,默认为false

是否单独返回去重后的所有链接列表,默认为false

with_images
boolean
默认值:false

是否单独返回内容中的图片URL列表,默认为false

with_images_alt
boolean
默认值:false

是否返回内容中图片的alt文本,默认为false

with_iframes
boolean
默认值:false

是否返回网页嵌入的iframe内容,默认为false

响应

成功响应

id
string
必填

请求ID

created
integer<unix-timestamp>
必填

请求创建时间戳

result
object
必填

网页读取结果

usage
object
必填