主题
content_analysis/category_trends/live
#分析分类趋势(实时)
接口说明
该接口用于获取指定分类在给定时间范围的引用(citations)趋势数据。
可返回按天、周、月聚合的分类趋势结果,并附带以下维度统计:
- 头部引用域名 -绪倾向分布
- 正负中性感类型分布
- 文本分类分布
- 页面分类分布
- 页面类型分布
- 国家分布
- 语言分布
历史数据最早可追溯至 2022-10-31。
请求方式
POST https://api.seermartech.cn/v3/content_analysis/category_trends/live
请求体格式
所有 POST 数据均需使用 JSON(UTF-8 编码),并以数组形式提交:
json
[
{
"category_code": 10994,
"search_mode": "as_is",
"date_from": "2022-10-31",
"date_group": "month"
}
]调用限制
- 每分钟最多可发送
2000次 API 调用 - 支持结果筛选、排序及返回数量控制
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准
参考价格
该接口按请求计费。
若按示例响应中的单次请求成本 USD 0.02009 估算:
参考价约 ¥0.3214 / 次
实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求参数
任务参数说明
| 字段名 | 类型 | 说明 |
|---|---|---|
category_code | integer | 填。目标分类编码。可通过 /v3/content_analysis/categories/ 获取完整分类列表。 |
page_type | array | 可选。按页面类型过滤数据集。可选值:"ecommerce"、"news"、"blogs"、"message-boards"、"organization" |
search_mode | string | 可选。结果分组方式。as_is:返回目标 category_code 下引用数据;one_per_domain:每个域名返回一个该分类引用。默认值:as_is |
internal_list_limit | integer | 可选。限制数组中的数量。适用于:top_domains、text_categories、page_categories、countries、languages。默认值:1,最大值:20 |
date_from | string | 填。时间范围起始日期。最小值:2022-10-31。格式:yyyy-mm-dd |
date_to | string | 可选。时间范围结束日期。未指定时默认使用当天日期。格式:yyyy-mm-dd |
date_group | string | 可选。结果聚合粒度。可选值:day、week、month。默认值:month |
initial_dataset_filters | array | 可选。初始数据集过滤条件,作用于 /v3/content_analysis/search/live/ 支持的字段。最多支持 8 个过滤条件,可用逻辑运算符 and、or 组合。支持的比较运算符:regex、not_regex、<、<=、>、>=、=、<>、in、not_in、like、not_like、has、has_not、match、not_match。 like 和 not_like 支持使用 % 匹任意长度字符串。更多说明可参考 /v3/content_analysis/filters |
rank_scale | string | 可选。定义 rank 的计算与展示刻度。one_hundred:0–100;one_thousand:0–1000。默认值:one_thousand |
tag | string | 可选。自定义任务标识,最长 255 个字符。便于请求与结果。响应中会在 data 对象返回该值 |
响应结构
接口返回 JSON 编码数据,顶层 tasks 数组。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | API 当前版本 |
status_code | integer | 通用状态码。完整错误码见 /v3/appendix/errors |
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 | URL 路径 |
data | object | 回显请求中提交的参数 |
result | array | 结果数组 |
result 数组字段
| 字段名 | 类型 | 说明 |
|---|---|---|
type | string | 结果类型,固定为 content_analysis_trends |
date | string | 当前结果对应的日期 |
total_count | integer | 数据库中与请求匹的结果总量 |
rank | integer | 引用目标分类的所有 URL 的综合排名值。为给定日期下所有 URL 的归一化排名总和 |
top_domains | array | 头部引用域名列表。引用目标分类的域名及引用次数 |
sentiment_connotations | object | 绪涵分布。返回不同绪及对应的引用次数。可能值:anger、fear、happiness、love、sadness、share、neutral、fun |
connotation_types | object | 感极性分布。可能值:positive、negative、neutral |
text_categories | array | 文本分类分布。返回文本分类及引用次数。分类列表可通过 /v3/content_analysis/categories/ 获取 |
page_categories | array | 页面分类分布。返回页面分类及引用次数。分类列表可通过 /v3/content_analysis/categories/ 获取 |
page_types | object | 页面类型分布及各类型引用次数 |
countries | object | 国家分布及各国家引用次数。国家列表可通过 /v3/content_analysis/locations/ 获取 |
languages | object | 语言分布及各语言引用次数。语言列表可通过 /v3/content_analysis/languages/ 获取 |
过滤参数说明
initial_dataset_filters 可用于在趋势统计前,对初始数据集进行筛选。它作用于 /v3/content_analysis/search/live/ 支持的字段。
特性如下:
- 最多可同时设置
8个过滤条件 - 条件之间可通过
and、or组合 - 支持以下运算符:
regex、not_regex、<、<=、>、>=、=、<>、in、not_in、like、not_like、has、has_not、match、not_match
说明:
like/not_like支持%通符- 适合限定站点、语言、国家、感、页面类型等条件后,再查看分类趋势变化
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/content_analysis/category_trends/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"category_code": 10994,
"search_mode": "as_is",
"date_from": "2022-10-31",
"date_group": "month"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/content_analysis/category_trends/live"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
payload = [
{
"category_code": 10994,
"search_mode": "as_is",
"date_from": "2022-10-31",
"date_group": "month"
}
]
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const payload = [
{
category_code: 10994,
search_mode: "as_is",
date_from: "2022-10-31",
date_group: "month",
},
];
axios.post(
"https://api.seermartech.cn/v3/content_analysis/category_trends/live",
payload,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
).then((response) => {
// 输出接口返回结果
console.log(response.data);
}).catch((error) => {
console.error(error.response?.data || error.message);
});响应示例
以下示例基于参考文档返回结构整理,部分缺失字段按原文保留为省略形式用于说明数据结构。
json
{
"version": "0.1.20220819",
"status_code": 20000,
"status_message": "Ok.",
"time": "19.4363 sec.",
"cost": 0.02009,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "content_analysis",
"function": "phrase_trends",
"keyword": "logitech",
"search_mode": "as_is",
"date_from": "2022-09-01",
"date_group": "month"
},
"result": [
{
"sentiment_connotations": {
"anger": 33,
"happiness": 32457,
"love": 4976,
"sadness": 290,
"share": 33841,
"fun": 1212
},
"connotation_types": {
"positive": 390289,
"negative": 135916,
"neutral": 589516
},
"text_categories": [
{
"count": 112695
},
{
"category": null,
"count": 55421
}
],
"page_categories": [
{
"count": 54264
},
{
"count": 24245
}
],
"page_types": {
"blogs": 622032,
"organization": 118086,
"news": 230980,
"message-boards": 18590,
"ecommerce": 96451
},
"countries": {
"US": 86504,
"WW": 56826,
"DE": 30522,
"IN": 21831,
"VN": 20049,
"AU": 19544,
"BR": 16685,
"JP": 16651,
"GB": 16405,
"ES": 15335
},
"languages": {
"en": 712751,
"ja": 114912,
"de": 63841,
"es": 60616,
"fr": 53833,
"it": 27394,
"vi": 23817,
"ru": 16528,
"pt": 11518,
"hu": 8393
}
},
{
"type": "content_analysis_trends",
"date": "2022-10-01",
"total_count": 1430023,
"rank": 613,
"top_domains": [],
"sentiment_connotations": {
"anger": 9,
"happiness": 36007,
"love": 4062,
"sadness": 128,
"share": 52651,
"fun": 971
},
"connotation_types": {
"positive": 735206,
"negative": 175341,
"neutral": 468693
},
"page_types": {
"blogs": 809466,
"organization": 44189,
"news": 256351,
"message-boards": 26910,
"ecommerce": 137036
},
"countries": {
"BE": 344693,
"US": 90030,
"WW": 68847
},
"languages": {
"en": 963542,
"ja": 112659,
"de": 82151
}
},
{
"type": "content_analysis_trends",
"date": "2022-11-01",
"total_count": 130203,
"rank": 462,
"top_domains": [],
"sentiment_connotations": {
"anger": 0,
"happiness": 6607,
"love": 236,
"sadness": 8,
"share": 4486,
"fun": 1595
},
"connotation_types": {
"positive": 76016,
"negative": 20227,
"neutral": 24780
},
"page_types": {
"blogs": 78908,
"organization": 6034,
"news": 18164,
"message-boards": 5147,
"ecommerce": 12120
},
"countries": {
"BE": 42874,
"WW": 9893,
"US": 5008
},
"languages": {
"en": 90074,
"es": 7246,
"ja": 5861
}
}
]
}
]
}状态码与错误处理
- 顶层
status_code表示整个请求的处理状态 tasks[].status_code表示单个任务状态- 建议同时检查:
- 顶层
status_code tasks_error- 每个任务的
status_code - 完整错误码列表可参考
/v3/appendix/errors
建议处理方式:
- 顶层状态码不为成功时,直接记录并终止处理
- 若
tasks_error > 0,逐个检查失败任务 - 对空结果、参数错误、限、日期越界等做显式底
- 使用响应中的
cost字段进行成本统计
使用说明与注意事项
category_code为填参数,调用前建议通过/v3/content_analysis/categories/获取可用分类- 最早可查询日期为
2022-10-31 date_to省略时默认取当天date_group会影响结果粒度与趋势分析方式:day:适合短周期波动分析week:适合观察周度变化month:适合长期趋势归纳- 若需要单一大站对结果造成过度影响,可使用
search_mode=one_per_domain - 若只心头部项,建议通过
internal_list_limit控制数组长度,减少返回体积 rank_scale影响rank的展示刻度,不改变原始统计逻辑
实用场景
- 监控行业热度变化:按月或按周查看某一分类的引用量、排名和感分布,判断行业话题是否升温,选题规划。
- 识别主导来源:通过
top_domains分析哪些站点在某分类中最活跃,帮助锁定核心媒体、竞品站点或高价值合作对象。 - 拆解版型结构:结合
page_types与page_categories观察该分类主要集中在新闻、博客还是电商页面,为投放和 SEO 页面策略提供依据。 - 分析地域与语言扩散趋势:通过
countries和languages判断某分类在哪些国家和语种中传播更快,用于 SEO 市场优级排序。 - 筛选特定条件下的趋势数据:借助
initial_dataset_filters限定国家、语言、页面类型或感倾向,再分析趋势变化,适合做更精细的舆与研究。