Douyin-Search-API

获取搜索关键词推荐 V2/Fetch search keyword suggestions V2

Changed on

[中文]

用途:

  • 获取抖音搜索关键词的联想推荐结果(V2 版本)。
  • 根据用户已输入的关键词前缀,返回相关搜索词建议,用于实现搜索框实时补全。

备注:

  • 返回条数由抖音决定,不支持指定数量。
  • history_words 为可选项,传入用户此前搜索过的词(英文逗号分隔)会影响联想词排序。
  • 相比 V1,V2 直接给出纯词列表 words,无需再从原始结构中提取。

参数:

  • keyword: 已输入的关键词,如 "人工智能"
  • history_words: 可选,历史搜索词,如 "猫咪,美食"

请求体示例:

payload = {
    "keyword": "人工智能",
    "history_words": ""
}

返回(部分常用字段,实际返回字段更多,一切以实际响应为准):

  • words[]: 联想词字符串列表(多数场景只需要这个)
  • items[]: 联想词完整条目,需要高亮位置或来源信息时使用
    • content: 联想词内容
    • pos[]: 命中位置(begin 起始字符位置、end 结束字符位置)
    • word_record: 词记录(group_id 词组ID、words_source 词来源等)
    • extra_info: 附加信息
  • virtual[]: 虚拟联想词列表(部分关键词才有)
  • empty_reason: 没有联想词时给出的原因(仅在结果为空时返回)

[English]

Purpose:

  • Fetch Douyin search keyword suggestions (V2).
  • Returns suggested keywords for the entered prefix, for real-time search-box completion.

Notes:

  • The number of suggestions is decided by Douyin and cannot be specified.
  • history_words is optional; passing the user's previous search words (comma separated) affects the ranking of the suggestions.
  • Compared with V1, V2 returns a plain words list directly, no extraction needed.

Parameters:

  • keyword: The entered keyword, e.g., "Artificial Intelligence"
  • history_words: Optional history search words, e.g., "cat,food"

Request Body Example:

payload = {
    "keyword": "Artificial Intelligence",
    "history_words": ""
}

Response (common fields, actual response may contain more fields):

  • words[]: Plain list of suggested keywords (enough for most use cases)
  • items[]: Full suggestion entries, use when highlight positions or sources are needed
    • content: Suggested keyword
    • pos[]: Matched position (begin / end character positions)
    • word_record: Word record (group_id, words_source, etc.)
    • extra_info: Extra information
  • virtual[]: Virtual suggestion list (only for some keywords)
  • empty_reason: Why the suggestion list is empty (only returned when there is no result)
post/api/v1/douyin/search/fetch_search_suggest_v2

Request

  • Base URL
    https://api.tikhub.io (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Request body

keywordstring

需要联想的关键词/The keyword to be suggested

history_wordsstring

可选,用户的历史搜索词(英文逗号分隔),会影响联想词的排序/Optional, the user's history search words (comma separated), affects the ranking of suggestions

Response

Successful Response

codeinteger

HTTP status code | HTTP状态码

request_idstring nullable

Unique request identifier | 唯一请求标识符

messagestring

Response message (EN-US) | 响应消息 (English)

message_zhstring

Response message (ZH-CN) | 响应消息 (中文)

supportstring

Support message | 支持消息

timestring

The time the response was generated | 生成响应的时间

time_stampinteger

The timestamp the response was generated | 生成响应的时间戳

time_zonestring

The timezone of the response time | 响应时间的时区

docsstring nullable

Link to the API Swagger documentation for this endpoint | 此端点的 API Swagger 文档链接

cache_messagestring nullable

Cache message (EN-US) | 缓存消息 (English)

cache_message_zhstring nullable

Cache message (ZH-CN) | 缓存消息 (中文)

cache_urlstring nullable

The URL to access the cached result | 访问缓存结果的 URL

routerstring

The endpoint that generated this response | 生成此响应的端点

paramsunknown
dataunknown

Changes