Web Search、Web Extract 和 Web Map 服务的使用说明与接口文档
网页结果、页面文本和站点地图
由 SilentAPI Web Engine v1 驱动。Web Engine 尚处实验阶段,结果与速度可能波动。预计在线率 99.9%,目前算力有限,我们正在提升稳定性与在线率,并随需求增长扩容算力。
Web Search 为查询返回按排名排序的结果列表,Web Extract 返回页面或 PDF 的可读正文,Web Map 列出网站的页面。三者均可使用常用的 SilentAPI API 密钥,当前价格见 [ Services ] 页面。
层级
将 tier 设为 auto、standard 或 premium。设为 auto 时,请求先在 Standard 档上执行,仅当 Standard 档无法回答且你的余额足够时才会转到 Premium。实际提供服务的档位决定计费,显示在响应的 tier 字段中。
| 层级 | 行为 |
|---|---|
| auto | 默认先使用 Standard 层级,必要时再切换到 Premium 层级。 |
| standard | 数据中心代理。遵循 robots.txt。 |
| premium | 通过合乎道德与法律途径获取的住宅代理。可访问屏蔽数据中心流量的网站。 |
Web Extract 在标准版每页包含最高 1 MB 带宽,高级版最高 2 MB。超出部分,以及 Web Map,按标准版每 10 MB $0.01、高级版每 10 MB $0.02 收费,按 MB 计费。要发起请求,你的余额必须覆盖 1 GB 带宽,实际只按请求使用的量收费。
缓存
缓存默认开启,所有开启缓存的请求都按正常价格的十分之一计费,无论是否命中缓存副本。缓存副本在账户之间共享且不含账户信息。命中缓存的响应与全新请求的外观和价格相同,因此无人能知道他人查过什么。将 cache 设为 false 可始终获取全新答案并按正常价格计费,此时你的请求不会被存储。
缓存结果遵循各网站的缓存规则:Standard 最长保留 24 小时,Premium 最长保留 1 小时。当 freshness 为 day 时,Search结果保留 10 分钟;要求不缓存的页面保留 5 分钟。
如果来源不可用,可能会由较旧的缓存副本代为应答。
结果质量
我们持续努力让结果更相关,并减少垃圾、虚假网站和危险链接。每次搜索都会结合多个独立来源,当多个来源一致时排名更高。SilentAPI 会在返回答案前去除重复结果和跟踪参数。
SilentAPI 会去掉与查询不符的结果页,例如诱饵页面和无关的站外结果,且从不返回不安全协议的链接。两个屏蔽默认开启,可逐个关闭。block_threats 会移除钓鱼、诈骗、恶意软件、虚假商店和跟踪软件等已知域名下的结果和页面。block_ads 会移除广告和跟踪域名,除非你的查询明确指定该网站。将 filter 设为 false 可同时关闭两者,显式传入 block_threats 或 block_ads 值会覆盖该设置。
没有任何过滤是完美的,请像对待开放网络上的任何页面一样对待结果,并通过可信来源核实重要事实。
隐私与条款
SilentAPI不会记录你的查询、URL 或结果。网站看不到你的 IP 地址或账户。缓存仅保存查询或 URL 的哈希及结果,不含账户信息,每条记录都会在 24 小时内删除。详情见[ 隐私政策 ]。
你须对发送的查询和 URL,以及对所获内容的使用负责。你须遵守所访问的每个网站的条款,不得使用这些端点攻击任何网站或使其过载。完整规则见 [ Terms of Service ]。
区域
将 region 设为请求来源地,三个端点接受相同的值。如果该地区无响应,请求会自动转移到最近的区域。
| 值 | 行为 |
|---|---|
| auto | 默认值。将 country 设为下表所列国家代码的 Web Search 请求来自该国家,其他所有请求均来自美国。 |
| global | 每次请求从列表中随机使用一个国家。 |
| 区域名称 | north-america, latin-america, central-america, caribbean, south-america, europe, eu-west, eu-north, eu-east, asia, asia-east, asia-southeast, asia-south, oceania, middle-east, africa, africa-north, africa-west, or africa-east |
| 国家/地区代码 | us(美国)、ca(加拿大)、mx(墨西哥)、gt(危地马拉)、hn(洪都拉斯)、cr(哥斯达黎加)、pa(巴拿马)、do(多米尼加)、pr(波多黎各)、br(巴西)、ar(阿根廷)、cl(智利)、co(哥伦比亚)、pe(秘鲁)、uy(乌拉圭)、ec(厄瓜多尔)、ve(委内瑞拉)、gb(英国)、ie(爱尔兰)、de(德国)、fr(法国)、nl(荷兰)、be(比利时)、at(奥地利)、ch(瑞士)、es(西班牙)、pt(葡萄牙)、it(意大利)、se(瑞典)、no(挪威)、fi(芬兰)、dk(丹麦)、pl(波兰)、ro(罗马尼亚)、cz(捷克)、hu(匈牙利)、bg(保加利亚)、gr(希腊)、ua(乌克兰)、jp(日本)、kr(韩国)、tw(台湾)、hk(香港)、sg(新加坡)、in(印度)、pk(巴基斯坦)、th(泰国)、my(马来西亚)、id(印度尼西亚)、vn(越南)、au(澳大利亚)、nz(新西兰)、ae(阿联酋)、sa(沙特阿拉伯)、il(以色列)、tr(土耳其)、za(南非)、ng(尼日利亚)、ke(肯尼亚)、ma(摩洛哥)、tn(突尼斯)、gh(加纳)、ci(科特迪瓦)、tz(坦桑尼亚)或 ug(乌干达) |
Web Search
POST /v1/silentapi/search 为查询返回网页结果。
curl https://api.silentapi.com/v1/silentapi/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"private api gateway","max_results":3,"freshness":"week","lang":"en"}'
| 名称 | 类型 | 默认值 | 规则 |
|---|---|---|---|
| query | string | 必填 | Search 文本。q 可用作别名。 |
| tier | string | auto | 自动、标准或高级 |
| max_results | integer | 10 | 1 至 30。每组最多 10 个结果按一次搜索计费,因此 20 的费用是 10 的两倍,30 的费用是三倍。 |
| offset | integer | 0 | 0 至 29。跳过相应数量的结果以获取下一页,offset 加 max_results 保持在 30 或以下,且仅对返回的页面计费。 |
| safe | string | moderate | 适中、严格或关闭 |
| lang | string | en | 结果的语言代码或名称,例如 de、ja、pt-br 或 Persian |
| country | string | none | 本地结果的国家代码或名称,例如 us、CAN 或 Germany |
| region | string | auto | 取自区域列表的一个值 |
| freshness | string | none | 日、周或月 |
| topic | string | web | web 表示常规结果,news 表示新闻网站的近期文章,images 表示图片,videos 表示视频页面,tor 表示 Tor 网站,i2p 表示 I2P 网站,dark 表示同时搜索两个网络 |
| include_domains | array | none | 最多 20 个域名,例如 ["python.org"]。仅返回这些域名及其子域名的结果。 |
| exclude_domains | array | none | 最多 20 个域名,其结果将被移除 |
| cache | boolean | true | 允许使用缓存答案,价格为十分之一 |
| block_threats | boolean | true | 丢弃来自恶意主机的结果。传入 false 可保留它们 |
| block_ads | boolean | true | 丢弃广告和跟踪类结果。传入 false 可保留它们 |
| filter | boolean | true | 同时设置 block_threats 和 block_ads |
两个域名列表也接受逗号分隔的字符串。当 topic 为 news 时,每个结果还包含 source(发布者名称),freshness 可将文章限定为最近一天、一周或一个月。
{
"status": "ok",
"query": "private api gateway",
"results": [
{
"position": 1,
"title": "Example result",
"url": "https://example.com/page",
"domain": "example.com",
"snippet": "First lines of the page.",
"date": "2026-11-02"
}
],
"tier": "standard",
"cost": 0.1
}
| 字段 | 类型 | 含义 |
|---|---|---|
| status | string | 请求完成时为 ok |
| query | string | 已搜索的查询 |
| results | array | 按排名排序的结果。每个结果包含以下字段:排名 position、标题 title、链接 url、域名 domain 和摘要 snippet;已知时还会附加日期 date 和来源 source 信息。 |
| tier | string | 提供服务的层级 |
| cost | number | 以额度计费,同时通过 X-SilentAPI-Cost 标头发送 |
日期采用 YYYY-MM-DD 格式。结果链接中的跟踪参数(如 utm_source)会被移除,重复链接会合并为一个结果。
图像搜索
将 topic 设为 images 即可获取图片。每个结果保留 url(展示图片的页面),并新增 image(图片文件的直接链接)。width 和 height 在已知时给出以像素为单位的完整尺寸,同一页面可能因图片不同出现多次。freshness、safe 和两个域名列表的作用与网页结果相同,域名列表适用于页面而非图片文件。图片搜索与网页搜索的计费相同。
curl https://api.silentapi.com/v1/silentapi/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"red panda","topic":"images","max_results":2}'
{
"status": "ok",
"query": "red panda",
"results": [
{
"position": 1,
"title": "Red panda facts",
"url": "https://example.com/red-panda",
"domain": "example.com",
"snippet": "A red panda resting in a tree.",
"image": "https://example.com/uploads/red-panda.jpg",
"width": 2048,
"height": 1356
}
],
"tier": "standard",
"cost": 0.1
}
视频搜索
将 topic 设为 videos 可获取 YouTube、TikTok 和 Vimeo 等网站的视频页面。每个结果可附加 source(网站名)、channel(上传者)、duration(秒)、views(整数)和 date,日期来自上传时间,可能相差几天。YouTube 结果还有 thumbnail 链接,未知的字段会被省略。视频搜索与网页搜索计费相同。
{
"position": 1,
"title": "Red pandas at play",
"url": "https://www.youtube.com/watch?v=abcdefghijk",
"domain": "youtube.com",
"source": "YouTube",
"channel": "Example Zoo",
"duration": 56,
"views": 16900,
"date": "2026-10-29",
"thumbnail": "https://i.ytimg.com/vi/abcdefghijk/hqdefault.jpg"
}
暗网搜索
将 topic 设为 tor 可搜索 .onion 网站,设为 i2p 可搜索 .i2p 网站,设为 dark 可同时搜索两个网络。结果包含 title、url、domain 和 snippet,已知时还有 date。受信任链接目录确认地址的服务会排在前面,并将 verified 设为 true。冒充已收录服务名或使用无效 onion 地址的未知网站会被视为钓鱼,SilentAPI 会将其移除。暗网搜索仅在 Premium 档可用,将 tier 设为 auto 会为其使用 Premium。被禁的 onion 地址无论过滤设置如何都会从结果中移除。暗网搜索与 Premium 网页搜索计费相同。
curl https://api.silentapi.com/v1/silentapi/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"securedrop directory","topic":"tor","max_results":5}'
{
"status": "ok",
"query": "securedrop directory",
"results": [
{
"position": 1,
"title": "SecureDrop Directory",
"url": "http://vfnmxpa6fo4jdpyq3yneqhglluweax2uclvxkytfpmpkp5rsl75ir5qd.onion/",
"domain": "vfnmxpa6fo4jdpyq3yneqhglluweax2uclvxkytfpmpkp5rsl75ir5qd.onion",
"snippet": "A directory of SecureDrop instances.",
"date": "2026-11-21"
}
],
"tier": "premium",
"cost": 0.2
}
Web Extract 在 Premium 层级同样可读取 .onion 和 .i2p 页面,并拒绝相同的被禁地址。
Web Extract(Web Extract)
POST /v1/silentapi/extract 读取单个页面或 PDF 并返回其正文,不含菜单、广告或脚本。Web Extract 按页加下载的数据量计费。
curl https://api.silentapi.com/v1/silentapi/extract \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.iana.org/help/example-domains","format":"markdown","max_chars":20000}'
| 名称 | 类型 | 默认值 | 规则 |
|---|---|---|---|
| url | string | 必填 | http 或 https 地址,最长 2,048 个字符 |
| tier | string | auto | 自动、标准或高级 |
| format | string | markdown | Markdown 或纯文本 |
| max_chars | integer | 100000 | 500 至 400000 |
| region | string | auto | 取自区域列表的一个值 |
| lang | string | none | 首选页面语言(代码或名称,例如 fr 或 French),适用于提供多种语言的网站 |
| cache | boolean | true | 允许使用缓存答案,价格为十分之一 |
| links | boolean | false | 为 true 时,页面上找到的链接将在 links 中返回 |
| block_threats | boolean | true | 已知的恶意主机将被拒绝。传入 false 可允许它们 |
| block_ads | boolean | true | 指向广告和跟踪主机的链接将被移除。传入 false 可保留它们 |
| filter | boolean | true | 同时设置 block_threats 和 block_ads |
Web Extract 支持任何语言的页面,并以原文返回文本。PDF 文件按页读取为文本,响应中包含 pages 页数。
{
"status": "ok",
"url": "https://www.iana.org/help/example-domains",
"title": "Example page",
"description": "A short summary of the page.",
"language": "en",
"published": "2026-11-12",
"content_type": "text/html",
"format": "markdown",
"length": 26,
"truncated": false,
"content": "# Example page\n\nPage text.",
"image": "https://example.com/cover.jpg",
"tier": "standard",
"cost": 0.16
}
| 字段 | 类型 | 含义 |
|---|---|---|
| status | string | 请求完成时为 ok |
| url | string | 重定向后实际读取的地址 |
| title | string | 页面标题 |
| description | string | 页面摘要(页面提供时) |
| language | string | 页面语言(页面声明时) |
| published | string | 发布日期,格式为 YYYY-MM-DD(页面显示时) |
| content_type | string | 来源页面的类型 |
| format | string | Markdown 或纯文本 |
| length | integer | content 中的字符数 |
| truncated | boolean | 当文本长于 max_chars 时为 True |
| archived | string | 公开存档副本的抓取时间,仅在网站拒绝所有请求时出现 |
| copy_of | string | 当 Premium 档所有请求都被拒绝,而同一篇文章从另一网站读取成功时,所请求的地址由 url 注明 |
| content | string | 所请求格式的页面文本 |
| image | string | 页面的主图(有提供时) |
| pages | integer | 页数,仅适用于 PDF 文件 |
| links | array | 仅在 links 为 true 时出现。每个链接包含 url 及其 text,最多 500 个链接。 |
| tier | string | 提供服务的层级 |
| cost | number | 以额度计费,同时通过 X-SilentAPI-Cost 标头发送 |
无值的字段将从响应中省略,而不以 null 发送。
truncated 为 true 的页面包含前 max_chars 个字符。提高 max_chars 可获取更多文本。
Web Map(网站地图)
POST /v1/silentapi/map 列出网站的页面。它读取网站发布的站点地图,缺失或过短时补充首页上找到的链接。Web Map 按次加下载的数据量计费。
curl https://api.silentapi.com/v1/silentapi/map \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","max_urls":100,"search":"blog"}'
| 名称 | 类型 | 默认值 | 规则 |
|---|---|---|---|
| url | string | 必填 | 网站地址,例如 https://example.com |
| tier | string | auto | 自动、标准或高级 |
| max_urls | integer | 200 | 1 至 1000 |
| search | string | none | 仅返回包含此文本的地址,最长 200 个字符 |
| include_subdomains | boolean | false | 为 true 时,同时列出该网站子域名下的页面。 |
| region | string | auto | 取自区域列表的一个值 |
| cache | boolean | true | 允许使用缓存答案,价格为十分之一 |
| block_threats | boolean | true | 已知的恶意主机将被拒绝。传入 false 可允许它们 |
| block_ads | boolean | true | 指向广告和跟踪主机的链接将被移除。传入 false 可保留它们 |
| filter | boolean | true | 同时设置 block_threats 和 block_ads |
{
"status": "ok",
"url": "https://example.com",
"count": 2,
"urls": [
"https://example.com/blog",
"https://example.com/blog/first-post"
],
"tier": "standard",
"cost": 0.21
}
将 urls 中的任一地址传给 Web Extract 以读取该页面。
批量请求
Web Search 和 Web Extract 单次请求最多接受 10 个条目。向 Web Search 发送 queries、向 Web Extract 发送 urls,替代单个 query 或 url,其他所有字段适用于每个条目。
curl https://api.silentapi.com/v1/silentapi/extract \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls":["https://example.com","https://example.com/missing"],"format":"text"}'
各条目并行执行,并按发送顺序返回。每个条目与单次响应的字段相同;未能完成的条目其 status 为 error,并带有 error 对象,其中包含其 status、message、type 和 code。
{
"status": "ok",
"count": 2,
"failed": 1,
"items": [
{ "status": "ok", "url": "https://example.com", "content": "Page text.", "tier": "standard", "cost": 0.16 },
{ "status": "error", "url": "https://example.com/missing", "error": { "status": 404, "message": "The page was not found.", "type": "not_found_error", "code": "not_found" }, "cost": 0 }
],
"cost": 0.16
}
顶层的 cost 为该批次的总费用。当所有条目都无法完成时,请求将返回第一个条目的错误。
代码示例
Python
import requests
API = "https://api.silentapi.com/v1/silentapi"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
search = requests.post(f"{API}/search", headers=HEADERS, json={
"query": "rust async runtime",
"max_results": 5,
"include_domains": ["docs.rs", "rust-lang.org"]
}, timeout=90).json()
for result in search["results"]:
print(result["position"], result["title"], result["url"])
page = requests.post(f"{API}/extract", headers=HEADERS, json={
"url": search["results"][0]["url"],
"format": "markdown"
}, timeout=90).json()
print(page["title"])
print(page["content"][:500])
JavaScript
const API = 'https://api.silentapi.com/v1/silentapi';
const headers = { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' };
async function call(path, body) {
const response = await fetch(`${API}/${path}`, { method: 'POST', headers, body: JSON.stringify(body) });
const data = await response.json();
if (!response.ok) throw new Error(data.error.message);
return data;
}
const news = await call('search', { query: 'open source security', topic: 'news', freshness: 'week' });
const headlines = news.results.map((item) => `${item.date} ${item.source}: ${item.title}`);
const batch = await call('extract', { urls: news.results.slice(0, 3).map((item) => item.url), format: 'text' });
const pages = batch.items.filter((item) => item.status === 'ok');
const missed = batch.items.filter((item) => item.status === 'error').map((item) => `${item.url}: ${item.error.message}`);
客户端超时请设为至少 90 秒,因为速度慢的网站可能需要较长时间才能响应。
错误
三个端点均返回以下状态:
| 状态 | 含义 |
|---|---|
| 400 | 输入或 URL 无效 |
| 402 | 余额不足以支付该请求,或页面所需的带宽超出余额覆盖范围 |
| 403 | 无法抓取该网站,或被安全过滤拒绝;除非 block_threats 为 false,否则可能发生 |
| 404 | 未找到页面 |
| 413 | 页面过大 |
| 415 | 不支持的内容类型 |
| 422 | 页面过于复杂,或仅通过 JavaScript 显示内容 |
| 429 | 目标网站繁忙,响应中包含 Retry-After |
| 502 | 抓取失败 |
| 503 | 服务暂时不可用,响应中包含 Retry-After |
| 504 | 超时 |
错误与其他端点使用相同的响应体。当搜索或抓取本身失败时,响应体同样包含 cost,并会设置 X-SilentAPI-Cost 请求头:
{
"error": {
"message": "The page was not found.",
"type": "not_found_error",
"code": "not_found"
},
"cost": 0
}