# 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"
    }
  }
}
```
