主题
content_analysis/sentiment_analysis/live
POST /v3/content_analysis/sentiment_analysis/live
#分析 –感分析(实时)
本接口用于分析目标引用的感分布感极性、绪类型、页面类型、国家/地区和语言等维度。
请求方法与路径:
text
POST https://api.seermartech.cn/v3/content_analysis/sentiment_analysis/live计费说明
本接口按请求计费。参考价约 ¥0.1442 / 次,费用取决于任务及返回数据规模,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
所有 POST 请求体使用 UTF-8 编码的 JSON 格式,并将任务参数放请求体数组中。实时接口每次请求只能提交 1 个任务。
平台限流以认证说明中的 30/60/120 次/分钟规则为准
- 单次实时接口请求最多 1 个任务
- 同时发送的请求数最多为 30 个
- 支持设置返回结果数量、筛选条件和排序方式
请求参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
keyword | string | 是 | 目标,使用 UTF-8 编码。会被转换为小写。若要匹完整短语而不是独立,请使用双引号和反斜杠,例如:"keyword": "\"tesla palo alto\""。 |
keyword_fields | object | 否 | 按指定字段中的筛选数据。支持的字段 title、main_title、previous_title、snippet。可同时指定多个字段。精确短语匹同样需要使用双引号和反斜杠。 |
page_type | array | 否 | 按页面类型筛选数据。可选值:ecommerce、news、blogs、message-boards、organization。 |
internal_list_limit | integer | 否 | 限制数组中的最大数量。适用于 top_domains、text_categories、page_categories、countries、languages。默认值为 1,最大值为 20。 |
positive_connotation_threshold | float | 否 | 正向感概率阈值。设置后,响应中的 connotation_types 正向感概率大于或等于该阈值的引用。取值范围为 0–1,默认值为 0.4。 |
sentiments_connotation_threshold | float | 否 | 绪类型概率阈值。设置后,响应中的 sentiment_connotations 每种绪概率大于或等于该阈值的引用。取值范围为 0–1,默认值为 0.4。 |
initial_dataset_filters | array | 否 | 初始数据集筛选条件,用于筛选 Search 接口 支持的字段。最多添加 8 个筛选条件,并需在条件之间指定 and 或 or 逻辑运算符。 |
rank_scale | string | 否 | 指定 rank 字段的计算和展示范围。可选值:one_hundred(0–100)和 one_thousand(0–1000)。默认值为 one_thousand。 |
tag | string | 否 | 自定义任务标识,最大长度为 255 个字符。该值会原样返回在响应任务的 data 对象中,可用于请求和结果。 |
keyword_fields 示例
json
{
"keyword_fields": {
"snippet": "\"logitech mouse\"",
"main_title": "sale"
}
}initial_dataset_filters 示例
筛选条件最多支持 8 个,可使用以下运算符:
text
regex、not_regex、<、<=、>、>=、=、<>、in、not_in、
like、not_like、has、has_not、match、not_matchlike 和 not_like 支持使用 % 匹零个或多个字符。
示例:
json
{
"initial_dataset_filters": [
[
"and",
[
"domain",
"like",
"%example%"
]
]
]
}更多筛选规则请参考:
- Content Analysis API – Filters
- Content Analysis Categories
- Content Analysis Locations
- Content Analysis Languages
请求示例
curl
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/content_analysis/sentiment_analysis/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"keyword": "logitech",
"internal_list_limit": 1
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/content_analysis/sentiment_analysis/live"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
payload = [
{
"keyword": "logitech",
"internal_list_limit": 1
}
]
response = requests.post(url, headers=headers, json=payload)
if response.ok:
result = response.json()
print(result)
else:
print(f"HTTP 错误:{response.status_code}")
print(response.text)TypeScript
typescript
import axios from "axios";
const postArray = [
{
keyword: "logitech",
internal_list_limit: 1
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/content_analysis/sentiment_analysis/live",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: postArray
})
.then((response) => {
// 处理响应数据
console.log(response.data);
})
.catch((error) => {
console.error("请求失败:", error.response?.data || error.message);
});响应结构
接口返回 JSON 数据,顶层 tasks 数组。
顶层响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 通用响应状态码。成功通常为 20000。 |
status_message | string | 通用状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 分析结果数组。 |
完整错误码和状态说明请参考 /v3/appendix/errors。
结果字段
result 中的结果类型为:
text
content_analysis_sentiment_analysispositive_connotation_distribution
按感极性统计引用分布,支持以下类型:
positive:正向negative:负向neutral:中性
每种感类型对应一个 content_analysis_summary 对象,以下字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 content_analysis_summary。 |
total_count | integer | 结果总数。 |
rank | integer | 所有 URL 中的排名。 |
top_domains | array | 引用数量最多的域名及引用数量。 |
sentiment_connotations | object | 各种绪类型及对应引用数量。 |
connotation_types | object | 正向、负向和中性引用数量。 |
text_categories | array | 文本分类及各分类下的引用数量。 |
page_categories | array | 页面分类及各分类下的引用数量。 |
page_types | object | 页面类型及对应引用数量。 |
countries | object | 国家/地区代码及对应引用数量。 |
languages | object | 语言代码及对应引用数量。 |
sentiment_connotations
表示引用中的绪类型及引用数量。支持以下绪:
anger:愤怒happiness:快乐love:喜爱sadness:悲伤share:分享fun:趣味
connotation_types
表示引用的感极性:
json
{
"positive": 2286584,
"negative": 198296,
"neutral": 785304
}sentiment_connotation_distribution
按绪类型统计引用分布,支持:
anger、happiness、love、sadness、share、fun
每个绪类型下均一个 content_analysis_summary 对象,字段与 positive_connotation_distribution 中的感类型对象一致:
typetotal_countranktop_domainssentiment_connotationsconnotation_typestext_categoriespage_categoriespage_typescountrieslanguages
响应示例
以下为结构化示例,部分数组已简化:
json
{
"version": "0.1.20220819",
"status_code": 20000,
"status_message": "Ok.",
"time": "23.0121 sec.",
"cost": 0.1442,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "00000000-0000-0000-0000-000000000000",
"status_code": 20000,
"status_message": "Ok.",
"time": "22.9810 sec.",
"cost": 0.1442,
"result_count": 1,
"path": [
"v3",
"content_analysis",
"sentiment_analysis",
"live"
],
"data": {
"api": "content_analysis",
"function": "sentiment_analysis",
"keyword": "logitech",
"internal_list_limit": 1
},
"result": [
{
"type": "content_analysis_sentiment_analysis",
"positive_connotation_distribution": {
"positive": {
"type": "content_analysis_summary",
"total_count": 2854419,
"rank": 638,
"top_domains": [],
"sentiment_connotations": {
"anger": 67,
"happiness": 151184,
"love": 8793,
"sadness": 208,
"share": 118464,
"fun": 4955
},
"connotation_types": {
"positive": 2286584,
"negative": 198296,
"neutral": 785304
},
"text_categories": [],
"page_categories": [],
"page_types": {
"blogs": 1348461,
"organization": null,
"news": null,
"message-boards": null,
"ecommerce": null
},
"countries": {
"BE": 390724
},
"languages": {
"en": 1729629
}
},
"negative": {
"type": "content_analysis_summary",
"total_count": 1683708,
"rank": 638,
"top_domains": [],
"sentiment_connotations": {
"anger": 147,
"happiness": 87373,
"love": 2947,
"sadness": 708,
"share": 90589,
"fun": 4890
},
"connotation_types": {
"positive": 246750,
"negative": 1176349,
"neutral": 252617
},
"text_categories": [],
"page_categories": [],
"page_types": {
"blogs": 539005,
"organization": null,
"news": null,
"message-boards": null,
"ecommerce": null
},
"countries": {
"US": 100736
},
"languages": {
"en": 689101
}
},
"neutral": {
"type": "content_analysis_summary",
"total_count": 2854419,
"rank": 638,
"top_domains": [],
"sentiment_connotations": {
"anger": 48,
"happiness": 72433,
"love": 2073,
"sadness": 757,
"share": 90082,
"fun": 2248
},
"connotation_types": {
"positive": 579995,
"negative": 182173,
"neutral": 2437398
},
"text_categories": [],
"page_categories": [],
"page_types": {
"blogs": 1468065,
"organization": null,
"news": null,
"message-boards": null,
"ecommerce": null
},
"countries": {
"US": 338896
},
"languages": {
"en": 2441543
}
}
},
"sentiment_connotation_distribution": {
"anger": {
"type": "content_analysis_summary",
"total_count": 650,
"rank": 127,
"top_domains": [],
"sentiment_connotations": {
"anger": 177,
"happiness": 114,
"love": 0,
"sadness": 2,
"share": 2,
"fun": 1
},
"connotation_types": {
"positive": 113,
"negative": 352,
"neutral": 139
},
"text_categories": [],
"page_categories": [],
"page_types": {
"blogs": 125,
"organization": null,
"news": null,
"message-boards": null,
"ecommerce": null
},
"countries": {
"DE": 41
},
"languages": {
"de": 498
}
}
}
}
]
}
]
}错误处理
建议客户端同时检查以下状态:
- HTTP 状态码是否成功。
- 顶层
status_code是否为成功状态。 - 任务级
tasks[].status_code是否为成功状态。 tasks_error是否大于0。status_message是否错误或异常说明。
完整状态码和错误码请参考 /v3/appendix/errors。
实用场景
- 监测品牌的正负面舆,识别负向引用集中出现的国家、语言和页面类型,及时安排声誉管理。
- 分析竞品的用户绪结构,对比多个品牌的正向、负向和中性比例,为 SEO 与策略提供依据。
- 定位高负面绪来源,通过
sentiment_connotation_distribution和top_domains找出影响品牌认知的重点网站。 - 优化选题与页面类型布局,分析博客、新闻、电商和组织页面中的感表现,调整投放渠道。
- 构建舆报表,按国家/地区、语言、文本分类和页面分类汇总引用数据,为市场拓展和本地化 SEO 决策提供支持。