主题
获取无法抓取的资源
POST /v3/on_page/uncrawlable_resources
本接口使用 POST 方法,路径为:
/v3/on_page/uncrawlable_resources
本接口返回目标网站中因类型不一致而无法抓取的资源列表。当服务器响应中的类型,与资源在页面 HTML 中被引用时所推断的预期类型不一致时,该资源会被标记为无法抓取。
> 检查 HTTP 响应状态码为 200 的资源。
计费说明
当前使用本功能不收取费用。任务结果可在任务创建后的 30 天获取。
如平台后续产生计费,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求格式
所有 POST 请求数据使用 UTF-8 编码的 JSON 格式。请求体是 JSON 数组,每个数组代表一个任务。
json
[
{
"id": "07131248-1535-0216-1000-17384017ad04",
"limit": 10,
"offset": 0,
"filters": [
[
"meta.content_type",
"=",
"image/jpeg"
],
"and",
[
"url",
"like",
"%go%"
]
]
}
]请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 填。任务 ID,可从任务创建接口 /v3/on_page/task_post/ 的响应中获取。示例:07131248-1535-0216-1000-17384017ad04 |
limit | integer | 可选。最多返回的无法抓取资源数量。默认值为 100,最大值为 1000。 |
offset | integer | 可选。结果集偏移量,默认值为 0,最大值为 2000000。例如设置为 10 时,将跳过结果数组中的前 10 条资源,返回后续资源。 |
order_by | array | 可选。结果排序规则。可使用与 filters 相同的字段和表达式进行排序。每条排序规则使用 asc 或 desc 指定升序或降序,排序字段与排序方向之间使用逗号分隔。单次请求最多设置 3 条排序规则,多条规则之间使用逗号分隔。 |
filters | array | 可选。结果过滤条件。单次请求最多设置 8 个过滤条件,条件之间使用 and 或 or 连接。 |
过滤运算符
filters 支持以下运算符:
text
regex
not_regex
<
<=
>
>=
=
<>
in
not_in
like
not_likelike 和 not_like 支持使用 % 匹任意数量的字符零个字符。
过滤条件示例:
json
[
[
"meta.content_type",
"=",
"image/jpeg"
],
"and",
[
"url",
"like",
"%go%"
]
]完整过滤字段和阈值列表请参考过滤器说明。
响应字段
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。 |
status_message | string | 请求级说明信息。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,采用 UUID 格式。 |
status_code | integer | 任务状态码,通常位于 10000–60000 范围。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求 URL 路径。 |
data | object | 创建任务时提交的请求参数。 |
result | array | 任务结果数组。 |
result 结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
crawl_progress | string | 抓取会话状态。可选值:in_progress、finished。 |
crawl_status | object | 抓取会话的详细状态。 |
items | array | 无法抓取的资源列表。 |
crawl_status 字段
| 字段 | 类型 | 说明 |
|---|---|---|
max_crawl_pages | integer | 最大抓取页面数,即创建任务时设置的 max_crawl_pages。 |
pages_in_queue | integer | 当前仍在抓取队列中的页面数量。 |
pages_crawled | integer | 已抓取页面数量。 |
total_items_count | integer | 抓取目标网站时发现的无法抓取资源总数。 |
items_count | integer | 当前 items 数组中的资源数量。 |
items 资源字段
| 字段 | 类型 | 说明 |
|---|---|---|
url | string | 无法抓取的资源 URL。 |
reason | string | 资源无法抓取的原因。目前可取值:content_type_inconsistency。 |
status_code | integer | 资源返回的 HTTP 状态码。目前为 200。 |
fetch_time | string | 获取资源的日期和时间,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
meta | object | 资源数据。 |
meta 字段
| 字段 | 类型 | 说明 |
|---|---|---|
content_type | string | 资源返回的类型。 |
expected_content_types | array | 资源预期的类型列表。该列表由爬虫根据资源在页面中的引用方式推断得出。 |
cURL 示例
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/on_page/uncrawlable_resources" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"filters": [
[
"meta.content_type",
"=",
"image/jpeg"
],
"and",
[
"url",
"like",
"%go%"
]
],
"limit": 10
}
]'Python 示例
python
import requests
url = "https://api.seermartech.cn/v3/on_page/uncrawlable_resources"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
post_data = [
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"filters": [
["meta.content_type", "=", "image/jpeg"],
"and",
["url", "like", "%go%"],
],
"limit": 10,
}
]
response = requests.post(url, headers=headers, json=post_data)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
"请求失败,状态码:{},说明:{}".format(
result.get("status_code"),
result.get("status_message"),
)
)TypeScript 示例
typescript
import axios from "axios";
const postData = [
{
id: "07281559-0695-0216-0000-c269be8b7592",
filters: [
["meta.content_type", "=", "image/jpeg"],
"and",
["url", "like", "%go%"],
],
limit: 10,
},
];
axios
.post(
"https://api.seermartech.cn/v3/on_page/uncrawlable_resources",
postData,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
)
.then((response) => {
const result = response.data;
if (result.status_code === 20000) {
console.log(result);
} else {
console.error(
`请求失败,状态码:${result.status_code},说明:${result.status_message}`
);
}
})
.catch((error) => {
console.error("网络请求失败:", error.message);
});响应示例
json
{
"version": "0.1.20260223",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.3232 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "07281559-0695-0216-0000-c269be8b7592",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2901 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"on_page",
"uncrawlable_resources"
],
"data": {
"api": "on_page",
"function": "uncrawlable_resources",
"target": "univers-pc.fr",
"max_crawl_pages": 2500,
"max_crawl_depth": null
},
"result": [
{
"crawl_progress": "finished",
"crawl_status": {
"max_crawl_pages": 2500,
"pages_in_queue": 0,
"pages_crawled": 2500,
"total_items_count": 3,
"items_count": 3
},
"items": [
{
"url": "https://univers-pc.fr/wp-content/uploads/2024/11/MFC-J5740DW-4.png",
"reason": "content_type_inconsistency",
"status_code": 200,
"fetch_time": "2026-03-09 18:20:36 +00:00",
"meta": {
"content_type": "image/png",
"expected_content_types": [
"image/jpeg"
]
}
},
{
"url": "https://univers-pc.fr/wp-content/uploads/2025/12/asus-expertbook-b3605cva-mb0197x-1.jpg",
"reason": "content_type_inconsistency",
"status_code": 200,
"fetch_time": "2026-03-09 18:27:28 +00:00",
"meta": {
"content_type": "image/jpeg",
"expected_content_types": [
"image/png"
]
}
},
{
"url": "https://univers-pc.fr/wp-content/uploads/2025/12/asus-vivobook-flip-tp3407sa-flip-ql131x-3.jpg",
"reason": "content_type_inconsistency",
"status_code": 200,
"fetch_time": "2026-03-09 18:28:35 +00:00",
"meta": {
"content_type": "image/jpeg",
"expected_content_types": [
"image/png"
]
}
}
]
}
]
}
]
}状态码与异常处理
请在业务系统中根据顶层 status_code 和任务级 status_code 进行异常处理。
20000:请求或任务处理成功。- 状态码:表示请求失败、任务失败或参数校验未通过。
- 当
tasks_error大于0时,应逐项检查tasks数组中的任务状态和错误信息。 - 当
crawl_progress为in_progress时,抓取任务尚未完成,应稍后重新获取结果。 - 当
crawl_progress为finished时,可读取items中的完整检测结果。
实用场景
- 定位图片与媒体类型错误:筛选类型与页面引用类型不一致的资源,修复图片、视频或媒体文件的 MIME 类型,提升页面资源加载稳定性。
- 排查 CDN 或服务器响应异常:对返回
200但类型错误的资源进行汇总,定位 CDN 缓存、服务器响应头或文件映射问题。 - 批量理网站资源引用:通过 URL、类型等条件过滤问题资源,生成开发修复单,减少人工排查成本。
- 建立技术 SEO 监控流程:定期获取无法抓取资源并对比
total_items_count,持续跟踪网站技术问题趋势。 - 验证迁移或改版结果:在域名、CDN、CMS 或站点结构迁移后检查资源类型一致性,降低改版导致抓取异常的风险。