# Content Analysis – 情感分析 API

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/content_analysis/sentiment_analysis/live`

**Tags:** DataForSEO

某个关键词引用的情感分布：`positive_connotation_distribution`（positive、negative、neutral）和 `sentiment_connotation_distribution`（anger、happiness、love、sadness、share、fun）。`positive_connotation_threshold` 和 `sentiments_connotation_threshold` 设定分类需要达到的置信度才会计入。⚠️ 这两个区块已经包含在 `post_dataforseo_content_summary_live` 中，后者费用相同，还额外提供域名、分类、国家和语言——除非响应体积更重要，否则优先使用它。若要查看按星级评分划分的情感分布，请使用 `post_dataforseo_content_rating_distribution_live`。

### 计费参考

- 计量方式：按上报的响应成本计量。
- 参考请求估算：0.024 美元。
- 参考客户倍率：1.0。不得对已结算的客户金额再次应用。

仅供参考的元数据，不是账户报价、保证价格或消费上限。资源额度不同于 Felo 额度。最终扣费以 Felo 计费记录为准。

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **no**

### application/json

Schema:

```json
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "null"
    ],
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "keyword": {
            "type": "string",
            "description": "目标关键词\n必填字段\nUTF-8 编码\n关键词将转换为小写格式；\n注意：如需匹配完整短语而非单个关键词，请使用双引号和反斜杠；\n示例：\n\"keyword\": \"\\\"tesla palo alto\\\"\"\n有关 DataForSEO API 中 keyword 和 keywords 字段的规则与限制，请参阅这篇帮助中心文章"
          },
          "keyword_fields": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "目标关键词字段与目标关键词\n可选字段\n使用此参数按特定字段应包含的关键词筛选数据集；\n可指定的字段：title、main_title、previous_title、snippet\n可指定多个字段；\n注意：如需匹配完整短语而非单个关键词，请使用双引号和反斜杠；\n示例：\n\"keyword_fields\": {\n   \"snippet\": \"\\\"logitech mouse\\\"\",\n   \"main_title\": \"sale\"\n}"
          },
          "page_type": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "目标页面类型\n可选字段\n使用此参数按页面类型筛选数据集\n可能的值：\n\"ecommerce\"、\"news\"、\"blogs\"、\"message-boards\"、\"organization\""
          },
          "internal_list_limit": {
            "type": [
              "integer",
              "null"
            ],
            "description": "内部数组中的最大元素数量\n可选字段\n可使用此字段限制以下数组中的元素数量：\ntop_domains\ntext_categories\npage_categories\ncountries\nlanguages\n默认值：1\n最大值：20"
          },
          "positive_connotation_threshold": {
            "type": [
              "number",
              "null"
            ],
            "description": "正面情感阈值\n可选字段\n以与引用内容相关的正面情感概率指数阈值表示\n如果指定此字段，响应中的 connotation_types 对象将仅包含正面情感概率大于或等于指定值的引用数据\n可能的值：0 到 1\n默认值：0.4"
          },
          "sentiments_connotation_threshold": {
            "type": [
              "number",
              "null"
            ],
            "description": "情感倾向阈值\n可选字段\n以与引用内容相关的情感倾向概率指数阈值表示\n如果指定此字段，响应中的 sentiment_connotations 对象将仅包含各情感概率均大于或等于指定值的引用数据\n可能的值：0 到 1\n默认值：0.4"
          },
          "initial_dataset_filters": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "object",
                "null"
              ]
            },
            "description": "初始数据集筛选参数\n可选字段\n适用于 Search 端点中字段的初始筛选参数\n可同时添加多个筛选条件（最多 8 个）\n应在条件之间设置逻辑运算符 and、or\n支持以下运算符：\nregex、not_regex、<、<=、>、>=、=、<>、in、not_in、like、not_like、has、has_not、match、not_match\n可在 like 和 not_like 中使用 % 运算符，匹配任意长度（零个或多个字符）的字符串\n示例：\n[\"domain\",\"<>\", \"logitech.com\"]\n[[\"domain\",\"<>\",\"logitech.com\"],\"and\",[\"content_info.connotation_types.negative\",\">\",1000]]\n[[\"domain\",\"<>\",\"logitech.com\"]],\n\"and\",\n[[\"content_info.connotation_types.negative\",\">\",1000],\n\"or\",\n[\"content_info.text_category\",\"has\",10994]]]\n有关筛选条件的更多信息，请参阅 Content Analysis API – Filters\n有关初始数据集筛选条件的更多信息，请参阅这篇帮助中心文章。"
          },
          "rank_scale": {
            "type": [
              "string",
              "null"
            ],
            "description": "定义用于计算和显示 rank 值的量级\n可选字段\n可使用此参数选择 rank 值以 0–100 还是 0–1000 的量级呈现\n可能的值：\none_hundred — rank 值以 0–100 的量级显示\none_thousand — rank 值以 0–1000 的量级显示\n默认值：one_thousand\n有关此参数工作方式的更多信息，请参阅这篇帮助中心文章"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "用户自定义任务标识符\n可选字段\n字符数上限为 255\n可使用此参数标识任务，并将其与结果对应\n可在响应的 data 对象中找到指定的 tag 值"
          }
        },
        "example": [
          {
            "keyword": "logitech",
            "internal_list_limit": 1
          }
        ]
      }
    ]
  },
  "example": [
    {
      "keyword": "logitech",
      "internal_list_limit": 1
    }
  ]
}
```

## Responses

### 200 — 操作成功

Headers:
- `X-Request-Id` (string) — 联系 Felo 支持时需提供的请求标识符。

**application/json**

Schema: object | null

```json
{
  "type": [
    "object",
    "null"
  ],
  "oneOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResponseInfo"
    }
  ]
}
```

### 400 — 无法处理该请求。请检查请求参数。

### 401 — 需要有效的 Felo API 密钥。

### 402 — 由于未满足计费要求，请求无法继续。

### 403 — 该账户无权执行此操作。

### 429 — 已达到请求或支出限额。

### 502 — 服务无法完成该请求。

### 503 — API 或计费服务暂时不可用。

### 504 — 服务在处理请求时超时。

### default — 错误响应；上游透传响应可能采用提供方格式

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_BaseResponseInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseInfo`

```json
{
  "properties": {
    "version": {
      "type": [
        "string",
        "null"
      ],
      "description": "API 的当前版本"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "通用状态码\n完整响应码列表见此处"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "通用信息性消息\n完整的一般信息性消息列表见此处"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "总执行时间，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任务总费用，美元",
      "format": "double"
    },
    "tasks_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 数组中的任务数",
      "format": "int64"
    },
    "tasks_error": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 数组中返回错误的任务数",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseTaskInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo`

```json
{
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "任务标识符\n我们系统中 UUID 格式的唯一任务标识符"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "任务的状态码\n由 DataForSEO 生成，范围如下：10000-60000\n完整响应码列表见此处"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "任务的信息性消息\n完整的一般信息性消息列表见此处"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "执行时间，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任务总费用，美元",
      "format": "double"
    },
    "result_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "result 数组中的元素数",
      "format": "int64"
    },
    "path": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "URL 路径"
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "object",
          "null"
        ]
      },
      "description": "包含你在 POST 请求中指定的相同参数"
    }
  }
}
```

### Response36Afe1097B20_ContentAnalysisCategoriesInfo

`#/components/schemas/Response36Afe1097B20_ContentAnalysisCategoriesInfo`

```json
{
  "properties": {
    "category": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "integer",
          "null"
        ]
      }
    },
    "count": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResponseInfo

`#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResponseInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseInfo"
    },
    {
      "type": "object",
      "properties": {
        "tasks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveTaskInfo"
              }
            ]
          },
          "description": "任务数组"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResultInfo

`#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResultInfo`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "元素类型"
    },
    "positive_connotation_distribution": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_PositiveConnotationDistribution"
        }
      ],
      "description": "按情感含义类型划分的引用分布\n包含按情感类型（情感极性）分布的引用次数及相关数据的对象；\n可能的情感含义类型：positive、negative、neutral"
    },
    "sentiment_connotation_distribution": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_SentimentConnotationDistribution"
        }
      ],
      "description": "按情感含义划分的引用分布\n包含按情感（情绪反应）分布的引用次数及相关数据的对象；\n可能的情感含义类型：anger、happiness、love、sadness、share、fun"
    }
  }
}
```

### Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveTaskInfo

`#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSentimentAnalysisLiveResultInfo"
              }
            ]
          },
          "description": "结果数组"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_ContentAnalysisSummaryInfo

`#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "元素类型"
    },
    "total_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>我们数据库中与你的请求相关的结果总数</em>",
      "format": "int64"
    },
    "rank": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>引用 <code>keyword</code> 的所有 URL 的排名</em><br>引用目标 <code>keyword</code> 的所有 URL 排名的归一化总和"
    },
    "top_domains": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_TopDomainInfo"
          }
        ]
      },
      "description": "<em>引用目标关键词的热门域名</em><br>包含引用目标关键词的热门域名对象，以及每个域名的引用次数"
    },
    "sentiment_connotations": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "integer",
          "null"
        ],
        "format": "int64"
      },
      "description": "<em>情感含义</em><br>包含与目标关键词引用相关的情感（情绪反应），以及每种情感的引用次数<br>可能的情感含义：<code>anger</code>、<code>happiness</code>、<code>love</code>、<code>sadness</code>、<code>share</code>、<code>fun</code>"
    },
    "connotation_types": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "integer",
          "null"
        ],
        "format": "int64"
      },
      "description": "<em>情感含义类型</em><br>包含与关键词引用相关的情感类型（情感极性），以及每种情感类型的引用次数<br>可能的情感含义类型：<code>positive</code>、<code>negative</code>、<code>neutral</code>"
    },
    "text_categories": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisCategoriesInfo"
          }
        ]
      },
      "description": "<em>文本类别</em><br>包含文本类别对象及每个文本类别的引用次数<br>如需获取可用类别的完整列表，请参阅 <a href=\"/v3/content_analysis/categories/\" rel=\"noopener noreferrer\" target=\"_blank\">Categories</a> 端点"
    },
    "page_categories": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisCategoriesInfo"
          }
        ]
      },
      "description": "<em>页面类别</em><br>包含页面类别对象及每个页面类别的引用次数<br>如需获取可用类别的完整列表，请参阅 <a href=\"/v3/content_analysis/categories/\" rel=\"noopener noreferrer\" target=\"_blank\">Categories</a> 端点"
    },
    "page_types": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "integer",
          "null"
        ],
        "format": "int64"
      },
      "description": "<em>页面类型</em><br>包含页面类型及每种页面类型的引用次数"
    },
    "countries": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "integer",
          "null"
        ],
        "format": "int64"
      },
      "description": "<em>国家/地区</em><br>包含国家/地区及每个国家/地区的引用次数<br>如需获取可用国家/地区的完整列表，请参阅 <a href=\"/v3/content_analysis/locations/\" rel=\"noopener noreferrer\" target=\"_blank\">Locations</a> 端点"
    },
    "languages": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "integer",
          "null"
        ],
        "format": "int64"
      },
      "description": "<em>语言</em><br>包含语言及每种语言的引用次数<br>如需获取可用语言的完整列表，请参阅 <a href=\"/v3/content_analysis/languages/\" rel=\"noopener noreferrer\" target=\"_blank\">Languages</a> 端点"
    }
  }
}
```

### Response36Afe1097B20_PositiveConnotationDistribution

`#/components/schemas/Response36Afe1097B20_PositiveConnotationDistribution`

```json
{
  "type": "object",
  "properties": {
    "positive": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "negative": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "neutral": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    }
  }
}
```

### Response36Afe1097B20_SentimentConnotationDistribution

`#/components/schemas/Response36Afe1097B20_SentimentConnotationDistribution`

```json
{
  "type": "object",
  "properties": {
    "anger": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "happiness": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "love": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "sadness": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "share": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    },
    "fun": {
      "type": [
        "object",
        "null"
      ],
      "oneOf": [
        {
          "$ref": "#/components/schemas/Response36Afe1097B20_ContentAnalysisSummaryInfo"
        }
      ]
    }
  }
}
```

### Response36Afe1097B20_TopDomainInfo

`#/components/schemas/Response36Afe1097B20_TopDomainInfo`

```json
{
  "properties": {
    "domain": {
      "type": [
        "string",
        "null"
      ]
    },
    "count": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  }
}
```
