Skip to content

content_analysis/sentiment_analysis/live

POST /v3/content_analysis/sentiment_analysis/live

#分析-绪分析(实时)

接口说明

该接口用于获取目标引用的绪分析数据,返回不同绪极性与绪类型下的分布统计结果。

  • 请求方式:POST
  • 接口地址:https://api.seermartech.cn/v3/content_analysis/sentiment_analysis/live

计费与调用限制

本接口按请求计费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

调用限制说明:

  • 每分钟最多可发起 2000 次 API 调用
  • 同时进行中的最大请求数为 30
  • POST 数据使用 JSON(UTF-8 编码)
  • 请求体格式为 JSON 数组:[{ ... }]

你可以通过参数控制:

  • 返回结果数量
  • 数据过滤条件
  • 排序方式

请求参数

以下为任务设置字段说明。

字段名类型说明
keywordstring目标。。使用 UTF-8 编码。会被自动转换为小写。若需精确匹短语而不是独立,请使用带转义的双引号,例如:"keyword": "\"tesla palo alto\""
keyword_fieldsobject可选。按指定字段中的过滤数据集。可指定字段:titlemain_titleprevious_titlesnippet。支持同时指定多个字段。若需精确匹短语,请使用带转义的双引号,例如:"keyword_fields": { "snippet": "\"logitech mouse\"", "main_title": "sale" }
page_typearray可选。按页面类型过滤数据集。可选值:"ecommerce""news""blogs""message-boards""organization"
internal_list_limitinteger可选。限制数组中返回的最大数量。适用于:top_domainstext_categoriespage_categoriescountrieslanguages。默认值:1;最大值:20
positive_connotation_thresholdfloat可选。正向绪极性阈值,表示引用被判定为正向的概率阈值。若设置该参数,响应中的 connotation_types positive 概率大于或等于该值的引用数据。取值范围:01;默认值:0.4
sentiments_connotation_thresholdfloat可选。绪类型阈值,表示引用属于某个绪的概率阈值。若设置该参数,响应中的 sentiment_connotations 各绪概率大于或等于该值的引用数据。取值范围:01;默认值:0.4
initial_dataset_filtersarray可选。初始数据集过滤条件,作用于 /v3/content_analysis/search/live/ 端点中的字段。最多可同时添加 8 个过滤条件,并通过逻辑运算符 andor 连接。支持运算符:regexnot_regex<<=>>==<>innot_inlikenot_likehashas_notmatchnot_matchlikenot_like 支持 % 通任意长度字符串。更多过滤规则可参考 /v3/content_analysis/filters
rank_scalestring可选。定义 rank 字段的计算与展示尺度。可选值:one_hundred0–100)或 one_thousand0–1000)。默认值:one_thousand
tagstring可选。用户自定义任务标识,最大长度 255 个字符。可用于结果匹,响应中的 data 对象会原样返回该值

返回结果说明

接口返回 JSON 数据,顶层 tasks 数组。

顶层字段

字段名类型说明
versionstring当前 API 版本
status_codeinteger通用状态码,完整错误码说明见 /v3/appendix/errors
status_messagestring通用状态信息
timestring执行耗时,单位秒
costfloat本次请求总费用,单位 USD
tasks_countintegertasks 数组中的任务数量
tasks_errorinteger返回错误的任务数量
tasksarray任务结果数组

tasks[] 字段

字段名类型说明
idstring任务唯一标识,UUID 格式
status_codeinteger任务状态码,范围通常为 10000-60000
status_messagestring任务状态信息
timestring任务执行耗时,单位秒
costfloat任务费用,单位 USD
result_countintegerresult 数组中的数量
patharray请求路径
dataobject与请求时提交的参数一致
resultarray结果数组

result[] 字段

字段名类型说明
typestring素类型,固定为 content_analysis_sentiment_analysis
positive_connotation_distributionobject按绪极性分布的引用统计。 positivenegativeneutral 三类
sentiment_connotation_distributionobject按绪分布的引用统计。 angerhappinesslovesadnesssharefun

positive_connotation_distribution / sentiment_connotation_distribution 下的汇总对象

这些对象中的每个子项(如 positivenegativeneutral,或 angerhappiness 等)结构一致:

字段名类型说明
typestring素类型,固定为 content_analysis_summary
total_countinteger结果总数
rankinteger所有 URL 的综合排名值
top_domainsarray度最高的域名列表,以及各域名对应的引用数量
sentiment_connotationsobject绪统计。可能值:angerhappinesslovesadnesssharefun
connotation_typesobject绪极性统计。可能值:positivenegativeneutral
text_categoriesarray文本分类及各分类引用数。分类列表可通过 /v3/content_analysis/categories/ 获取
page_categoriesarray页面分类及各分类引用数。分类列表可通过 /v3/content_analysis/categories/ 获取
page_typesobject页面类型及各类型引用数
countriesobject国家分布及各国家引用数。国家列表可通过 /v3/content_analysis/locations/ 获取
languagesobject语言分布及各语言引用数。语言列表可通过 /v3/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"
payload = [
 {
 "keyword": "logitech",
 "internal_list_limit": 1
 }
]
headers = {
 "Authorization": "Bearer smt_live_YOUR_KEY",
 "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json)

TypeScript

typescript
import axios from "axios";

const payload = [
 {
 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: payload,
})
 .then((response) => {
 // 输出结果数据
 console.log(response.data);
 })
 .catch((error) => {
 console.error(error);
 });

响应示例

json
{
 "version": "0.1.20220819",
 "status_code": 20000,
 "status_message": "Ok.",
 "time": "23.0121 sec.",
 "cost": 0.02003,
 "tasks_count": 1,
 "tasks_error": 0,
 "tasks": [
 {
 "data": {
 "api": "content_analysis",
 "function": "sentiment_analysis",
 "keyword": "logitech",
 "internal_list_limit": 1
 },
 "result": [
 {
 "positive_connotation_distribution": {
 "positive": {
 "type": "content_analysis_summary",
 "total_count": 3270184,
 "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": [
 {
 "count": 26
 }
 ],
 "page_categories": [],
 "page_types": {
 "blogs": 125,
 "organization": null,
 "news": null,
 "message-boards": null,
 "ecommerce": null
 },
 "countries": {
 "DE": 41
 },
 "languages": {
 "de": 498
 }
 },
 "happiness": {
 "type": "content_analysis_summary",
 "total_count": 393934,
 "rank": 549,
 "top_domains": [],
 "sentiment_connotations": {
 "anger": 14,
 "happiness": 223776,
 "love": 888,
 "sadness": 17,
 "share": 3448,
 "fun": 1633
 },
 "connotation_types": {
 "positive": 186779,
 "negative": 94796,
 "neutral": 100161
 },
 "text_categories": [],
 "page_categories": [],
 "page_types": {
 "blogs": 105889,
 "organization": null,
 "news": null,
 "message-boards": null,
 "ecommerce": null
 },
 "countries": {
 "DE": 24845
 },
 "languages": {
 "en": 126472
 }
 }
 }
 }
 ]
 }
 ]
}

状态码与错误处理

  • 顶层 status_code 表示整个请求的执行状态
  • tasks[].status_code 表示单个任务的执行状态
  • 建议同时检查:
  • HTTP 状态码
  • 顶层 status_code
  • 任务级 tasks[].status_code

常见成功状态:

  • 20000:请求成功

完整错误码请参考:/v3/appendix/errors

使用建议

  1. 当你只心最主要的国家、语言、域名或分类时,可将 internal_list_limit 设为较小值以减少响应体积。
  2. 若需要聚焦明显正向或明显负向的,可提高 positive_connotation_thresholdsentiments_connotation_threshold
  3. 若业务上已有范围限制,建议通过 initial_dataset_filters 缩小样本集,再进行绪分析,以提高结果性。
  4. rank_scale 会影响 rank 的展示范围,跨项目对比时建议固定该参数。

实用场景

  • 评估品牌舆:分析某品牌在网引用中的正向、负向、中性分布,快速识别整体舆论倾向。
  • 识别绪热点:查看 angerhappinesssadness 等绪占比,帮助团队定位用户绪触发点。
  • 筛选高风险源:结合 top_domainscountrieslanguages 找出负面绪集中的来源站点与地区,便于响应。
  • 优化策略:按 page_typestext_categoriespage_categories 分析哪些类型更容易引发正向传播,指导选题与投放。
  • 监控活动反馈:针对促销、发布会或新品持续拉取绪分析结果,衡量市场反馈变化趋势。

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