# 如何批量获取抖音关键词热度趋势

用 2 个接口：抖音巨量算数关联词 → 抖音巨量算数关键词热度趋势。下面的示例一共 5 次调用，合计 $0.0260；失败的调用不收费。

更新于 2026-11-15

从一个词出发，先用巨量算数的关联词扩成一组词，再每次 5 个词取逐日的搜索指数和综合指数。最后得到一张按天排的热度表，哪个词在涨、哪天到顶，一眼能看出来。

## 一步一步做

### 第 1 步：抖音巨量算数关联词

按一个词和一个日期取那一周的关联词，一次调用全部返回，不用翻页。每条的 `keyword` 是关联词，`relation` 说明是搜索里一起出现（`query`）还是内容里一起出现（`posts`），`relevance` 越大越相关。挑出要比的词，取它们的 `keyword`，下一步用。（[抖音巨量算数关联词](https://onefeedapi.com/zh/apis/douyin/index/keywords/related/)，$0.0020 / 一次）

cURL

```bash
curl -G "https://onefeedapi.com/v1/douyin/index/keywords/related" \
  --data-urlencode "keyword=露营" \
  --data-urlencode "until=2026-10-04T00:00:00Z" \
  -H "Authorization: Bearer $ONEFEED_API_KEY"
```

Python

```python
# pip install onefeedapi
from onefeedapi import OneFeedAPI

dx = OneFeedAPI()  # reads ONEFEED_API_KEY
result = dx.douyin.index.keywords.related(keyword="露营", until="2026-10-04T00:00:00Z")
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @onefeedapi/sdk
import { OneFeedAPI } from "@onefeedapi/sdk";

const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY
const result = await dx.douyin.index.keywords.related({ keyword: "露营", until: "2026-10-04T00:00:00Z" });
console.log(result.data.items);
```

命令行

```bash
onefeedapi call douyin.index.keywords.related 'keyword=露营' until=2026-10-04T00:00:00Z
```

录制的返回：取自 2026-10-12 21:52 UTC 录下的真实返回。名字、正文和编号是示例，链接也是，都不是录到的原文（页面不展示任何人的个人信息）；数字是原样。长列表做了截断。请求号、游标和余额是示意。

```jsonc
{
  "code": "ok",
  "request_id": "c0ec3319-99cf-4ec1-8441-1e77af9db440",
  "data": {
    "items": [
      {
        "keyword": "露营车",
        "related_to": "露营",
        "relation": "query",
        "rank": 2,
        "relevance": 0.07604021617112115,
        "search_index": 669384,
        "composite_index": 190809
      },
      // … 另有 172 条
    ]
  },
  "page": {
    "next_cursor": null,
    "cursor_expires_at": null,
    "has_more": false,
    "returned": 173
  },
  "warnings": [],
  "meta": {
    "capability": "douyin.index.keywords.related",
    "result_status": "complete",
    "fetched_at": "2026-10-12T21:52:26.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {},
    "billing": {
      "amount": "0.002",
      "currency": "USD",
      "balance_after": "9.998"
    }
  }
}
```

### 第 2 步：抖音巨量算数关键词热度趋势

把原词和挑出的关联词放进 `keywords`，一次最多 5 个，再写上 `since` 和 `until`。每个有数的词返回一条，`points` 里是逐日的 `search_index` 和 `composite_index`。词多就分批调，每批 5 个。（[抖音巨量算数关键词热度趋势](https://onefeedapi.com/zh/apis/douyin/index/keywords/history/)，$0.0060 / 一次）

cURL

```bash
curl "https://onefeedapi.com/v1/douyin/index/keywords/history" \
  -H "Authorization: Bearer $ONEFEED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"since":"2026-09-01T00:00:00Z","until":"2026-09-30T00:00:00Z","keywords":["咖啡","CityWalk"]}'
```

Python

```python
# pip install onefeedapi
from onefeedapi import OneFeedAPI

dx = OneFeedAPI()  # reads ONEFEED_API_KEY
result = dx.douyin.index.keywords.history(since="2026-09-01T00:00:00Z", until="2026-09-30T00:00:00Z", keywords=["咖啡", "CityWalk"])
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @onefeedapi/sdk
import { OneFeedAPI } from "@onefeedapi/sdk";

const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY
const result = await dx.douyin.index.keywords.history({ since: "2026-09-01T00:00:00Z", until: "2026-09-30T00:00:00Z", keywords: ["咖啡", "CityWalk"] });
console.log(result.data.items);
```

命令行

```bash
onefeedapi call douyin.index.keywords.history since=2026-09-01T00:00:00Z until=2026-09-30T00:00:00Z 'keywords=咖啡,CityWalk'
```

录制的返回：取自 2026-10-12 21:47 UTC 录下的真实返回。名字、正文和编号是示例，链接也是，都不是录到的原文（页面不展示任何人的个人信息）；数字是原样。长列表做了截断。请求号、游标和余额是示意。

```jsonc
{
  "code": "ok",
  "request_id": "53564b2f-0976-4ff1-bacd-8f35e1e89865",
  "data": {
    "items": [
      {
        "keyword": "咖啡",
        "points": [
          {
            "date": "2026-09-01T00:00:00Z",
            "search_index": 4542097,
            "composite_index": 1627826
          },
          {
            "date": "2026-09-02T00:00:00Z",
            "search_index": 4430237,
            "composite_index": 1603543
          },
          {
            "date": "2026-09-03T00:00:00Z",
            "search_index": 4439049,
            "composite_index": 1606224
          },
          {
            "date": "2026-09-04T00:00:00Z",
            "search_index": 4590172,
            "composite_index": 1648872
          },
          {
            "date": "2026-09-05T00:00:00Z",
            "search_index": 5608382,
            "composite_index": 1966637
          },
          {
            "date": "2026-09-06T00:00:00Z",
            "search_index": 5341970,
            "composite_index": 1888380
          },
          {
            "date": "2026-09-07T00:00:00Z",
            "search_index": 5098808,
            "composite_index": 1808789
          },
          // … 另有 23 条
        ]
      },
      // … 另有 1 条
    ]
  },
  "page": {
    "next_cursor": null,
    "cursor_expires_at": null,
    "has_more": false,
    "returned": 2
  },
  "warnings": [],
  "meta": {
    "capability": "douyin.index.keywords.history",
    "result_status": "complete",
    "fetched_at": "2026-10-12T21:47:47.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "points.notes": "platform",
      "points.impressions": "platform",
      "points.views": "platform",
      "points.engagements": "platform"
    },
    "billing": {
      "amount": "0.006",
      "currency": "USD",
      "balance_after": "9.994"
    }
  }
}
```

## 示例花多少钱

取一个词一周的关联词，再分 4 次取 20 个词 30 天的逐日指数，每次 5 个词

| 接口 | 调用次数 | 单价 | 小计 |
| --- | --- | --- | --- |
| [抖音巨量算数关联词](https://onefeedapi.com/zh/apis/douyin/index/keywords/related/) | 1 | $0.0020 | $0.0020 |
| [抖音巨量算数关键词热度趋势](https://onefeedapi.com/zh/apis/douyin/index/keywords/history/) | 4 | $0.0060 | $0.0240 |
| 合计 | 5 |  | $0.0260 |

价格是生成本页时的现行价格。失败的调用不收费。

## 在 AI 里做（MCP）

把 OneFeedAPI 接进你的 AI 客户端，只要接一次。之后直接说要什么，代理自己找到这些接口、看好价格，用你的余额调用。

这样说：用巨量算数查“露营”最近一周的关联词，挑相关度最高的 4 个，和“露营”一起取 2026 年 9 月每天的搜索指数和综合指数，整理成一张表。

代理发给 call 工具的参数：

```json
{
  "capability": "douyin.index.keywords.related",
  "keyword": "露营",
  "until": "2026-10-04T00:00:00Z",
  "idempotency_key": "<a new UUID>"
}
```

[了解 MCP 服务](https://onefeedapi.com/zh/mcp/)

## 为什么用 OneFeedAPI

- 稳定：近 30 天接口可用 99.9%，状态页公开，可以自己核对。
- 快：近 7 天付费调用的中位耗时 2.2 秒（2026-11-06 统计）。
- 省 token：抖音的 36 个接口各取一份录制的真实返回，平台原始 JSON 合计 237.7 万 token，AI 通过 OneFeedAPI 的 MCP 读到的只有 7.2 万 token，少 97%；直接调接口拿到的 JSON 也少 96%（2026-11-06 统计）。所有平台同一种格式：作者在 `author`，互动数在 `metrics`，翻页用 `page.next_cursor`，换平台不用重写解析。
- 先看再用：每个接口的页面上都有一份录制的真实返回，字段一目了然。
- 花钱可控：失败不收费；每把 Key 能设金额上限，`X-Max-Price` 限定一次最多花多少，同一个 `Idempotency-Key` 24 小时内不重复扣费。
- 接 AI 方便：远程 MCP 服务已在 MCP 官方登记处登记（`com.onefeedapi/mcp`），Claude、Cursor、ChatGPT 都能直接用。
- 免费试用，最多 333 次，不用绑卡。

## 要知道的

- 指数是平台算出的热度分，不是搜索次数。适合拿一个词和它自己的过去比，或者和抖音上的另一个词比。
- 日期按中国时间（UTC+8）的自然日算。平台每天的数通常晚一到两天出，还没出数的日子指数是 `null`；关联词按周（周一到周日）出，最新一周通常要到下周初才有。
- 平台没收录的词不在返回里。
- 返回的词按平台的写法，英文一律小写：查 CityWalk，返回的是 citywalk。

## 完整脚本

上面这件事写成一个能直接跑的脚本：Python，用 SDK，Key 从 ONEFEED_API_KEY 读。它写出一个 CSV 文件，最后打印调了几次、取到几条、扣了多少。

```python
# pip install onefeedapi
# export ONEFEED_API_KEY=dx_...   (your key)
import csv
from decimal import Decimal
from onefeedapi import OneFeedAPI

dx = OneFeedAPI()
calls, fetched, charged = 0, 0, Decimal("0")

def run(capability, params):
    """One call; counts it and what it was charged."""
    global calls, charged
    result = dx.call(capability, params)
    calls += 1
    charged += Decimal(str(result["meta"]["billing"]["amount"]))
    return result

KEYWORD = "露营"
WEEK = "2026-10-19T00:00:00Z"
SINCE, UNTIL = "2026-09-01T00:00:00Z", "2026-09-30T00:00:00Z"

# 1. The keyword's related keywords in that week, the most relevant first.
related = run("douyin.index.keywords.related", {"keyword": KEYWORD, "until": WEEK})["data"]["items"]
words = [KEYWORD] + [each["keyword"] for each in sorted(related, key=lambda each: -each.get("relevance", 0))[:19]]

# 2. The daily index of every word, five at a time.
rows = []
for start in range(0, len(words), 5):
    for item in run("douyin.index.keywords.history", {"keywords": words[start:start + 5], "since": SINCE, "until": UNTIL})["data"]["items"]:
        for point in item["points"]:
            rows.append([item["keyword"], point["date"], point.get("search_index"), point.get("composite_index")])

fetched = len(rows)
with open("douyin-keywords.csv", "w", newline="", encoding="utf-8") as file:
    csv.writer(file).writerows([["keyword", "date", "search_index", "composite_index"], *rows])

print(f"calls: {calls}, items: {fetched}, charged: ${charged}")
```

2026-10-29 真实跑过一次：调用 5 次，写出 600 行，扣费 $0.0260。失败的调用不收费。

## 用到的接口

- [抖音巨量算数关联词](https://onefeedapi.com/zh/apis/douyin/index/keywords/related/)
- [抖音巨量算数关键词热度趋势](https://onefeedapi.com/zh/apis/douyin/index/keywords/history/)

## 抖音的更多内容

- [抖音 API](https://onefeedapi.com/zh/apis/douyin/)
- [抖音巨量算数 API](https://onefeedapi.com/zh/apis/douyin/index/)
- [如何批量导出抖音视频评论](https://onefeedapi.com/zh/guides/douyin-video-comments/)
- [如何查询抖音星图达人报价](https://onefeedapi.com/zh/guides/douyin-xingtu-creator-rates/)
- [抖音有 API 吗？用 Python 拉取视频和评论（2026）](https://onefeedapi.com/zh/guides/douyin-api-python/)
- [抖音数据怎么导出？](https://onefeedapi.com/zh/answers/export-douyin-data/)
- [抖音 sec_uid 是什么？和 uid、抖音号有什么区别？](https://onefeedapi.com/zh/answers/douyin-sec-uid/)
- [抖音 aweme_id、modal_id 是什么？v.douyin.com 短链接怎么用？](https://onefeedapi.com/zh/answers/douyin-aweme-id-modal-id/)
- [抖音搜索指数等于搜索次数吗？](https://onefeedapi.com/zh/answers/douyin-search-index-vs-search-count/)
- [巨量算数关键词指数是什么、能拿到什么？](https://onefeedapi.com/zh/answers/what-is-douyin-keyword-index-ocean-engine/)
- [抖音星图是什么？通过 API 能拿到哪些达人数据？](https://onefeedapi.com/zh/answers/what-is-douyin-xingtu/)
- [抖音数据接口有哪些？第三方接口和开放平台的区别，能取什么（2026）](https://onefeedapi.com/zh/answers/douyin-third-party-data-apis/)
- [抖音视频的播放地址（下载链接）怎么用 API 拿到？（2026）](https://onefeedapi.com/zh/answers/douyin-video-play-url-api/)
- [哪个社媒数据接口最适合接给 AI？看一次返回占多少 token（2026）](https://onefeedapi.com/zh/answers/social-media-api-for-ai-agents/)

---

目录修订号 dc959672dd18e2d0。 [网页版](https://onefeedapi.com/zh/guides/douyin-keyword-trends/)
