主题
站链接查询
接口说明
该接口用于返回目标网站中检测到的链接与外部链接列表。
支持识别的链接类型:
anchor:锚文本链接,指向网页中的某个页面或位置image:图片链接canonical:规范页链接meta:通过meta http-equiv="refresh"定义的跳转链接alternate:通过link rel="alternate"指向网页替代版本的链接redirect:返回重定向状态的链接
请求方式
POST https://api.seermartech.cn/v3/on_page/links
计费说明
使用本接口本身不会产生额外扣费;已创建任务的结果可在后续 30 天获取。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
使用前提
调用本接口前,需要通过 /v3/on_page/task_post/ 创建抓取任务,并在响应中获取任务 id。本接口基于该 id 返回已抓取页面中的链接数据。
请求体说明
所有 POST 数据需使用 UTF-8 编码的 JSON 格式,请求体为 JSON 数组:
json
[
{
"id": "07131248-1535-0216-1000-17384017ad04"
}
]请求参数
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 填。任务 ID。可从 /v3/on_page/task_post/ 的响应中获取。示例:07131248-1535-0216-1000-17384017ad04 |
page_from | string | 可选。相对页面 URL。指定后返回该页面上的链接。只能填写相对 URL |
page_to | string | 可选。相对页面 URL。指定后返回指向该页面的链接。只能填写相对 URL |
limit | integer | 可选。返回链接数量上限。默认 100,最大 1000 |
offset | integer | 可选。结果偏移量。默认 0,最大 2000000。例如设置为 10,则跳过前 10 条结果并返回后续数据 |
filters | array | 可选。结果过滤条件数组,最多支持 8 个过滤条件。条件之间需使用逻辑运算符 and 或 or 连接 |
search_after_token | string | 可选。后续翻页请求令牌。适用于单次结果 20,000 条时时。该值会在每次响应中返回;传后可获取上一批结果之后的数据。注意:如果请求中使用了 search_after_token,则参数与上一次请求一致 |
tag | string | 可选。用户自定义任务标识,最长 255 个字符。可用于业务侧映射请求与结果,响应的 data 对象中会返回该值 |
filters 支持规则
支持的比较/匹运算符:
regexnot_regex=<>innot_inlikenot_like
说明:
like和not_like支持使用%匹任意长度字符串(可为 0 个字符)- 多个条件之间需插
and或or
示例:
json
[
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"page_from": "/apis/google-trends-api",
"filters": [
["dofollow", "=", true],
"and",
["direction", "=", "external"]
],
"limit": 10
}
]可用过滤字段的完整列表可参考 /v3/on_page/filters_and_thresholds/。
响应结构
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码 |
status_message | string | 通用状态信息 |
time | string | 执行时间,单位秒 |
cost | float | 所有任务合计费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数 |
tasks_error | integer | 返回错误的任务数量 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 本平台任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态说明 |
time | string | 任务执行时间,单位秒 |
cost | float | 当前任务费用,单位 USD |
result_count | integer | result 数组数量 |
path | array | 请求路径 |
data | object | 回显请求参数 |
result | array | 结果数组 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
crawl_progress | string | 抓取进度状态。可能值:in_progress、finished |
crawl_status | object | 抓取会话 |
crawl_status.max_crawl_pages | integer | 抓取页数上限,对应创建任务时设置的 max_crawl_pages |
crawl_status.pages_in_queue | integer | 当前仍在抓取队列中的页面数 |
crawl_status.pages_crawled | integer | 已抓取页面数 |
total_items_count | integer | 数据库中符合条件的总结果数 |
items_count | integer | 当前结果集中 items 的数量 |
items | array | 链接明细列表 |
链接结果字段说明
不同 type 的链接会一组通用字段,以及少量类型特有字段。
通用字段
以下字段适用于大多数链接类型:
| 字段名 | 类型 | 说明 |
|---|---|---|
type | string | 链接类型 |
domain_from | string | 来源域名,即链接被发现所在的域名 |
domain_to | string | 目标域名,即链接指向的域名 |
page_from | string | 来源页面的相对 URL |
page_to | string | 目标页面的相对 URL |
link_from | string | 来源页面的绝对 URL |
link_to | string | 目标页面的绝对 URL |
dofollow | boolean | 是否为 dofollow。若为 true,表示没有 rel="nofollow" |
page_from_scheme | string | 来源页面 URL 协议 |
page_to_scheme | string | 目标页面 URL 协议 |
direction | string | 链接方向:internal 或 external |
is_broken | boolean | 是否为失效链接,即目标页面或资源不可用 |
is_link_relation_conflict | boolean | 是否存在链接冲突。若为 true,说明至少存在一个指向同一 link_to 的 nofollow 链接,且至少存在一个 dofollow 链接 |
page_to_status_code | integer | 目标页面 HTTP 状态码 |
各链接类型字段
1)anchor 链接
type = "anchor",表示来自 <a> 标签的普通链接。
附加字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
link_attribute | array | 添加在外链上的链接属性,表示 page_from 上指向 link_to 的属性 |
text | string | 锚文本 |
2)image 链接
type = "image",表示 <a> 标签中 <img> 的图片链接。
附加字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
link_attribute | array | 添加在外链上的链接属性 |
text | string | 图片文本 |
image_alt | string | 图片的 alt 替代文本 |
image_src | string | 图片 URL |
3)link 标签链接
type = "link",表示来自 <link> 标签的链接。
无额外专属字段,使用通用字段即可。
4)canonical 链接
type = "canonical",表示规范页链接,通常来自 <meta rel="canonical"> 定义。
无额外专属字段,使用通用字段即可。
5)meta 跳转链接
type = "meta",表示通过如下形式定义的跳转链接:
html
<meta http-equiv="refresh" content="X;url=https://example.com">无额外专属字段,使用通用字段即可。
6)alternate 链接
type = "alternate",表示来自 <link rel="alternate"> 的替代版本链接。
附加字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
is_valid_hreflang | boolean | hreflang 是否实现有效 |
hreflang | string | hreflang 属性值,例如 en-US、fr |
7)redirect 链接
type = "redirect",表示 HTTP 3xx 重定向链接。
无额外专属字段,使用通用字段即可。
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/on_page/links" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"page_from": "/apis/google-trends-api",
"filters": [
["dofollow", "=", true],
"and",
["direction", "=", "external"]
],
"limit": 10
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/on_page/links"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
payload = [
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"page_from": "/apis/google-trends-api",
"filters": [
["dofollow", "=", True],
"and",
["direction", "=", "external"]
],
"limit": 10
}
]
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const payload = [
{
id: "07281559-0695-0216-0000-c269be8b7592",
page_from: "/apis/google-trends-api",
filters: [
["dofollow", "=", true],
"and",
["direction", "=", "external"]
],
limit: 10
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/on_page/links",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: payload
})
.then((response) => {
// 输出接口结果
console.log(response.data);
})
.catch((error) => {
console.error(error);
});响应示例
json
{
"version": "0.1.20201117",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1513 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "on_page",
"function": "links",
"page_from": "/apis/google-trends-api",
"limit": 10
},
"result": [
{
"crawl_progress": "finished",
"crawl_status": {
"max_crawl_pages": 100,
"pages_in_queue": 0,
"pages_crawled": 100
},
"total_items_count": 2,
"items_count": 2,
"items": [
{
"type": "anchor",
"domain_from": "example.com",
"domain_to": "external-site.com",
"page_from": "/apis/google-trends-api",
"page_to": "/landing-page",
"link_from": "https://example.com/apis/google-trends-api",
"link_to": "https://external-site.com/landing-page",
"link_attribute": ["noopener", "noreferrer"],
"dofollow": true,
"page_from_scheme": "https",
"page_to_scheme": "https",
"direction": "external",
"is_broken": false,
"text": "查看",
"is_link_relation_conflict": false,
"page_to_status_code": 200
}
]
}
]
}
]
}状态码与异常处理
- 顶层
status_code表示整个请求的处理状态 tasks[].status_code表示单个任务的处理状态- 建议同时校验这两个状态字段,并建立统一的异常处理机制
- 错误码完整列表可参考
/v3/appendix/errors
常见处理建议:
20000:请求成功- 非
20000:应记录status_message并按任务粒度处理重试、告警或回退逻辑
实用场景
- 排查失效链接:批量识别
is_broken=true的页和外链,及时修复跳转错误,减少用户流失并提升爬虫抓取质量。 - 梳理站链接结构:按
page_from、page_to和direction分析页面间链接流向,优化重要落地页的链支持。 - 审核外链属性:筛选外部链接的
dofollow、link_attribute与冲突状态,规范赞助、合作与 UGC 页面链接策略。 - 检查 hreflang 与多语言版本:基于
alternate类型链接核验hreflang与is_valid_hreflang,提升多地区页面的搜索匹准确性。 - 识别重定向与规范化问题:结合
redirect、canonical、meta类型链接,发现不合理的跳转链路和规范页设置,减少索引分散。