Skip to content

Content Analysis 过滤器

概述

本文档说明 Content Analysis API 可用的过滤器规则,以及过滤条件的组织方式。

过滤器与返回结果 result 数组中的特定对象,因此在构造筛选条件时,对应结果对象的字段路径填写。通过本接口,你可以获取 Content Analysis 端点支持的过滤字段列表。

接口说明

  • 请求方式GET
  • 接口路径/v3/content_analysis/available_filters
  • 完整地址https://api.seermartech.cn/v3/content_analysis/available_filters
  • 计费说明:该接口本身不收费
  • 费用说明:扣费以响应头 X-SeerMarTech-Charge-CNY 为准

调用本接口后,服务端会返回 JSON 数据 tasks 数组,以及各任务对应的可用过滤参数列表。

返回结构

字段名类型说明
versionstringAPI 当前版本
status_codeinteger整体状态码,完整列表参见 /v3/appendix/errors
status_messagestring整体状态信息,完整列表参见 /v3/appendix/errors
timestring执行耗时,单位秒
costfloat总任务费用,单位 USD
tasks_countintegertasks 数组中的任务数量
tasks_errorintegertasks 数组中执行报错的任务数量
tasksarray任务列表

tasks 数组中的字段

字段名类型说明
idstring任务唯一标识,UUID 格式
status_codeinteger任务状态码,范围通常为 10000-60000,完整列表参见 /v3/appendix/errors
status_messagestring任务状态信息
timestring任务执行耗时,单位秒
costfloat任务费用,单位 USD
result_countintegerresult 数组中的数量
patharrayURL 路径
dataobjectGET 请求 URL 中传的参数
resultarray结果数组,该接口支持的过滤参数,通常按可用端点分组返回

过滤器结构说明

Content Analysis API 的筛选条件统一通过 filters 数组传。

字段名类型说明
filtersarray结果过滤参数数组

基本规则

  • 最多可同时添加 8 个过滤条件
  • 当存在多个条件时,在条件之间显式逻辑运算符:
  • and
  • or

过滤器组成

一个过滤条件通常以下三部分:

  1. filtered_field
  2. filter_operator
  3. filter_value

1)filtered_field

  • 类型string
  • 说明:可用于筛选的字段名

部分字段采用嵌套路径形式,例如:

  • "domain_rank"
  • "content_info.title"
  • "content_info.sentiment_connotations.fun"

某些字段路径还可能采用以下结构:

  • content_info.$parameter_field
  • content_info.$results_array.$parameter_field

2)filter_operator

  • 类型string
  • 说明:过滤操作符,需与字段类型匹

数值类型 num

可用操作符:

  • <
  • <=
  • >
  • >=
  • =
  • <>
  • in
  • not_in

字符串类型 str

可用操作符:

  • like
  • not_like
  • =
  • <>
  • regex
  • not_regex
  • in
  • not_in
  • match
  • not_match

字符串数组 array.str

可用操作符:

  • has
  • has_not

数值数组 array.num

可用操作符:

  • has
  • has_not

时间类型 time

可用操作符:

  • <
  • >

时间格式写为:

yyyy-mm-dd hh-mm-ss +00:00

示例:

2021-01-29 15:02:37 +00:00

额外说明

  • 使用 innot_in 时,filter_value须是数组
  • regexnot_regex 支持的最大字符长度为 1000

3)filter_value

  • 类型:取决于字段类型
  • 说明:筛选值,与 filtered_field 的数据格式一致

过滤器使用建议

在 Content Analysis 接口中,过滤器是针对 result 中对象字段生效的。因此,构造筛选条件前,建议明确目标端点返回的字段结构,再填写对应字段路径。

常见思路:

  • 按站点权重筛选:如 domain_rank
  • 按标题筛选:如 content_info.title
  • 按感倾向筛选:如 content_info.sentiment_connotations.fun

请求示例

cURL

bash
curl --location --request GET "https://api.seermartech.cn/v3/content_analysis/available_filters" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"

Python

python
import requests

url = "https://api.seermartech.cn/v3/content_analysis/available_filters"
headers = {
 "Authorization": "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
}

response = requests.get(url, headers=headers)
print(response.json)

TypeScript

typescript
import axios from "axios";

axios({
 method: "get",
 url: "https://api.seermartech.cn/v3/content_analysis/available_filters",
 headers: {
 Authorization: "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json",
 },
}).then((response) => {
 // 输出结果数据
 console.log(response.data);
}).catch((error) => {
 console.error(error);
});

响应示例

json
{
 "version": "0.1.20220819",
 "status_code": 20000,
 "status_message": "Ok.",
 "time": "0.0553 sec.",
 "cost": 0,
 "tasks_count": 1,
 "tasks_error": 0,
 "tasks": [
 {
 "data": {
 "api": "content_analysis",
 "function": "available_filters"
 },
 "result": []
 }
 ]
}

状态码说明

顶层状态码

  • 20000:请求成功
  • 通用错误码请参考:/v3/appendix/errors

任务状态码

每个任务对象中也会返回单独的:

  • status_code
  • status_message

用于表示该任务的执行结果。任务状态码通常位于 10000-60000 范围。

使用要点

  • 本接口用于查询 Content Analysis 可用过滤字段
  • 返回可作为 Content Analysis 端点构造 filters 参数的依据
  • 多条件组合时,显式指定 andor
  • 单次最多支持 8 个过滤条件
  • regex / not_regex 的表达式长度最多 1000 字符
  • 时间型过滤值使用 UTC 偏移格式,如 2021-01-29 15:02:37 +00:00

实用场景

  • 筛选高价值源:按 domain_rank 等字段过滤高权重站点,帮助 SEO 团队优分析更参考价值的页面来源。
  • 定位特定主题:按 content_info.title 或正文字段匹,快速提取某一主题下的文章或页面样本。
  • 分析绪倾向:基于 content_info.sentiment_connotations.* 字段筛选带有特定感特征的,舆与品牌研究。
  • 构建精准监测规则:结合 and / or 组合多个条件,建立更贴近业务目标的筛选逻辑,减少无数据干扰。
  • 校验过滤能力边界:在正式调用分析结果接口前,获取支持字段列表,降低字段传错、类型不匹带来的集成成本。

统一入口:官网 · LLM API · 控制台