Skip to content

抖音视频搜索 API (V4) ​

GET
接口健康状态
健康 可用 少量可用 基本不可用 暂无数据
正在加载健康状态…

按关键词搜索抖音视频,支持排序、发布时间、时长和分页筛选;后续页面需要上一页的搜索ID。用于支持内容发现和趋势研究。

请求参数 ​

参数名位置类型必填默认值说明
tokenquerystring是-此 API 服务的访问令牌。
keywordquerystring是-搜索关键词。
sortTypequerystring否_0搜索结果排序标准。


可用值:

- _0:综合

- _1:点赞最多

- _2:最新
publishTimequerystring否_0按视频发布时间范围筛选。


可用值:

- _0: 不限

- _1: 最近24小时

- _7: 最近7天

- _180: 最近6个月
durationquerystring否_0按视频时长筛选。


可用值:

- _0: 不限时长

- _1: 1分钟以内

- _2: 1-5分钟

- _3: 超过5分钟
pagequeryinteger否1页码(从1开始)。
searchIdquerystring否-搜索ID;页面大于1时需要。使用前一次响应中的 data.business_config.next_page.search_id,当 data.business_config.has_more 为 0 时停止分页。

代码示例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE'
text
我想使用 JustOneAPI 提供的“视频搜索 (V4)”接口。
接入地址: https://api.justoneapi.com。
接口路径: /api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE
接口地址: BASE_URL + /api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE
HTTP 方法: GET
身份验证: 在 URL 中传入 token 查询参数。
OpenAPI 定义: https://docs.justoneapi.com/openapi/douyin-tiktok-china/video-search-v4-zh.json

请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- keyword (query): 搜索关键词。 (必填)
- sortType (query): 搜索结果排序标准。

可用值:
- `_0`:综合
- `_1`:点赞最多
- `_2`:最新
- publishTime (query): 按视频发布时间范围筛选。

可用值:
- `_0`: 不限
- `_1`: 最近24小时
- `_7`: 最近7天
- `_180`: 最近6个月
- duration (query): 按视频时长筛选。

可用值:
- `_0`: 不限时长
- `_1`: 1分钟以内
- `_2`: 1-5分钟
- `_3`: 超过5分钟
- page (query): 页码(从1开始)。
- searchId (query): 搜索ID;页面大于1时需要。使用前一次响应中的 data.business_config.next_page.search_id,当 data.business_config.has_more 为 0 时停止分页。

返回格式: 请根据实际 Content-Type 安全处理 JSON 或文本响应。

响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为 120 秒;如果 120 秒偏长,请至少设置为 60 秒,但可能会有少量请求因超时而未接收到结果。
3. 业务码说明:
   - 0: 成功
   - 100: Token 无效或已失效
   - 301: 采集失败,请重试
   - 302: 超出速率限制
   - 303: 超出每日配额
   - 400: 参数错误
   - 500: 内部服务器错误
   - 600: 权限不足
   - 601: 账户余额不足
   - 602: TOKEN 限额超限
4. code 601 表示账户共享余额不足。code 602 表示当前 API TOKEN 自身的累计消费上限已达到。TOKEN 限额不是资金划拨,多个 TOKEN 仍共享同一个账户余额。

请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # 由 OpenAPI servers 提供

url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
const url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
        final String url = BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // 由 OpenAPI servers 提供

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // 由 OpenAPI servers 提供
$url = $BASE_URL . '/api/douyin/search-video/v4?token=YOUR_API_KEY&keyword=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

返回字段 ​

业务成功时(code = 0)的主要返回字段。

搜索结果与分页8 个字段

data

抖音关键词搜索的结果及分页信息。

字段类型说明
business_dataarray搜索结果卡片列表。同一视频可能出现在多页,可按 aweme_id 对视频结果去重。
business_configobject分页和查询信息。
business_config.keywordstring平台返回的搜索关键词。
business_config.card_countinteger平台返回的当前页结果卡片数量。
business_config.has_moreinteger | string该值为 0 时停止翻页,即使响应仍包含搜索 ID。结果结束时可能只返回此分页标记。
business_config.next_pageobject后续分页信息,有相关信息时返回。
business_config.next_page.search_idstring用于请求下一页的搜索 ID。将该值传入 searchId,将 page 加 1,并保持关键词和筛选条件一致。连续页面可能返回相同的搜索 ID。
status_codenumber | string抖音搜索状态码,有该值时返回。
结果卡片2 个字段

data.business_data[]

字段类型说明
data_idstring卡片在当前响应中的标识。
typeinteger结果类型编码。已观察到 1 表示视频结果,66667 表示相关搜索。
视频基础信息12 个字段

data.business_data[].data.aweme_info

卡片包含视频结果时返回的抖音视频信息。

字段类型说明
aweme_idstring抖音视频的稳定 ID,以字符串返回。可用该值在搜索结果的不同页面中识别同一个视频。
group_idstring平台返回的作品分组标识。
author_user_idinteger发布账号的数字型 ID。
descstring抖音提供的作品描述。
captionstring抖音提供的作品文案。
item_titlestring作品标题,有该值时返回。
preview_titlestring作品预览使用的标题。
create_timeinteger视频发布时间,Unix 时间戳,单位为秒。
durationinteger视频时长,单位为毫秒。
aweme_typeinteger抖音返回的作品类型编码。
media_typeinteger抖音返回的媒体类型编码。
ip_attributionstring抖音返回的 IP 属地标识,有该值时返回。
作者26 个字段

data.business_data[].data.aweme_info.author

随视频返回的作者资料。

字段类型说明
uidstring抖音账号 ID,以字符串返回。
sec_uidstring抖音用户资料接口使用的备用账号标识。
nicknamestring作者的显示昵称。
unique_idstring公开展示的抖音号,有该值时返回。
short_idstring抖音返回的账号短标识。
follower_countinteger平台返回的作者粉丝数。
is_verifiedboolean抖音是否将作者标记为已认证。
verification_typeinteger平台返回的作者认证类别编码。
avatar_thumbobject作者头像缩略图。
avatar_thumb.uristring抖音返回的资源标识。
avatar_thumb.url_listarray资源的链接列表。
avatar_thumb.url_list[]string一条资源链接。
avatar_thumb.widthinteger资源信息中记录的宽度,单位为像素。
avatar_thumb.heightinteger资源信息中记录的高度,单位为像素。
avatar_mediumobject作者头像的中等尺寸版本。
avatar_medium.uristring抖音返回的资源标识。
avatar_medium.url_listarray资源的链接列表。
avatar_medium.url_list[]string一条资源链接。
avatar_medium.widthinteger资源信息中记录的宽度,单位为像素。
avatar_medium.heightinteger资源信息中记录的高度,单位为像素。
avatar_largerobject作者头像的大尺寸版本。
avatar_larger.uristring抖音返回的资源标识。
avatar_larger.url_listarray资源的链接列表。
avatar_larger.url_list[]string一条资源链接。
avatar_larger.widthinteger资源信息中记录的宽度,单位为像素。
avatar_larger.heightinteger资源信息中记录的高度,单位为像素。
互动指标7 个字段

data.business_data[].data.aweme_info.statistics

平台返回的视频互动统计。

字段类型说明
aweme_idstring该统计关联的抖音视频 ID。
digg_countinteger平台返回的视频点赞数。
comment_countinteger平台返回的视频评论数。
collect_countinteger平台返回的视频收藏数。
share_countinteger平台返回的视频分享数。
forward_countinteger响应中返回的转发数。
download_countinteger平台返回的视频下载数。
视频封面22 个字段

data.business_data[].data.aweme_info.video

字段类型说明
coverobject视频封面图片。
cover.uristring抖音返回的资源标识。
cover.url_listarray资源的链接列表。
cover.url_list[]string一条资源链接。
cover.widthinteger资源信息中记录的宽度,单位为像素。
cover.heightinteger资源信息中记录的高度,单位为像素。
origin_coverobject原始封面字段中的封面图片。
origin_cover.uristring抖音返回的资源标识。
origin_cover.url_listarray资源的链接列表。
origin_cover.url_list[]string一条资源链接。
origin_cover.widthinteger资源信息中记录的宽度,单位为像素。
origin_cover.heightinteger资源信息中记录的高度,单位为像素。
dynamic_coverobject动态封面资源,有相关信息时返回。
dynamic_cover.uristring抖音返回的资源标识。
dynamic_cover.url_listarray资源的链接列表。
dynamic_cover.url_list[]string一条资源链接。
dynamic_cover.widthinteger资源信息中记录的宽度,单位为像素。
dynamic_cover.heightinteger资源信息中记录的高度,单位为像素。
animated_coverobject动画封面资源,有相关信息时返回。
animated_cover.uristring抖音返回的资源标识。
animated_cover.url_listarray资源的链接列表。
animated_cover.url_list[]string一条资源链接。
播放与清晰度51 个字段

data.business_data[].data.aweme_info.video

视频信息及可用的播放资源。

字段类型说明
durationinteger视频时长,单位为毫秒。
widthinteger抖音返回的视频宽度,单位为像素。
heightinteger抖音返回的视频高度,单位为像素。
formatstring抖音返回的视频格式。
ratiostring抖音返回的清晰度标签。
has_watermarkboolean视频信息中返回的水印标记。
play_addrobject视频的主要播放地址。
play_addr.uristring抖音返回的资源标识。
play_addr.url_listarray资源的链接列表。
play_addr.url_list[]string一条资源链接。
play_addr.widthinteger资源信息中记录的宽度,单位为像素。
play_addr.heightinteger资源信息中记录的高度,单位为像素。
play_addr.data_sizeinteger资源信息中记录的文件大小,单位为字节。
play_addr_h264objectH.264 版本的播放地址。
play_addr_h264.uristring抖音返回的资源标识。
play_addr_h264.url_listarray资源的链接列表。
play_addr_h264.url_list[]string一条资源链接。
play_addr_h264.widthinteger资源信息中记录的宽度,单位为像素。
play_addr_h264.heightinteger资源信息中记录的高度,单位为像素。
play_addr_h264.data_sizeinteger资源信息中记录的文件大小,单位为字节。
play_addr_265objectH.265 播放字段中返回的地址。
play_addr_265.uristring抖音返回的资源标识。
play_addr_265.url_listarray资源的链接列表。
play_addr_265.url_list[]string一条资源链接。
play_addr_265.widthinteger资源信息中记录的宽度,单位为像素。
play_addr_265.heightinteger资源信息中记录的高度,单位为像素。
play_addr_265.data_sizeinteger资源信息中记录的文件大小,单位为字节。
download_addrobject视频下载地址。
download_addr.uristring抖音返回的资源标识。
download_addr.url_listarray资源的链接列表。
download_addr.url_list[]string一条资源链接。
download_addr.widthinteger资源信息中记录的宽度,单位为像素。
download_addr.heightinteger资源信息中记录的高度,单位为像素。
download_addr.data_sizeinteger资源信息中记录的文件大小,单位为字节。
bit_ratearray视频的播放编码版本和码率信息。
bit_rate[]object视频的一个播放编码版本。
bit_rate[].bit_rateinteger编码码率,单位为比特每秒。
bit_rate[].FPSinteger帧率,单位为帧每秒。
bit_rate[].formatstring平台返回的该编码版本媒体格式。
bit_rate[].gear_namestring平台返回的该版本编码档位标签。
bit_rate[].quality_typeinteger平台返回的该编码版本画质类别编码。
bit_rate[].is_h265integer平台返回的该版本 H.265 编码标记。
bit_rate[].HDR_typestring该编码版本返回的 HDR 类别标签。
bit_rate[].HDR_bitstring该编码版本返回的 HDR 位深标签。
bit_rate[].play_addrobject该编码版本的播放地址。
bit_rate[].play_addr.uristring抖音返回的资源标识。
bit_rate[].play_addr.url_listarray资源的链接列表。
bit_rate[].play_addr.url_list[]string一条资源链接。
bit_rate[].play_addr.widthinteger资源信息中记录的宽度,单位为像素。
bit_rate[].play_addr.heightinteger资源信息中记录的高度,单位为像素。
bit_rate[].play_addr.data_sizeinteger资源信息中记录的文件大小,单位为字节。
音乐与音频17 个字段

data.business_data[].data.aweme_info.music

与视频关联的音乐或声音信息。

字段类型说明
idinteger数字型音乐 ID。在 JavaScript 中使用支持无损数字解析的 JSON 解析器保留完整值。
id_strstring音乐 ID,以字符串返回。
midstringmid 字段返回的音乐 ID。
titlestring声音或音乐音轨的标题。
authorstring随音轨返回的艺人或声音创作者名称。
albumstring专辑名称,有该值时返回。
is_original_soundboolean抖音是否将该音轨标记为原声。
cover_thumbobject声音或音乐音轨的封面缩略图。
cover_thumb.uristring抖音返回的资源标识。
cover_thumb.url_listarray资源的链接列表。
cover_thumb.url_list[]string一条资源链接。
cover_thumb.widthinteger资源信息中记录的宽度,单位为像素。
cover_thumb.heightinteger资源信息中记录的高度,单位为像素。
play_urlobject声音或音乐音轨的播放资源。
play_url.uristring抖音返回的资源标识。
play_url.url_listarray资源的链接列表。
play_url.url_list[]string一条资源链接。
分享、话题与提及19 个字段

data.business_data[].data.aweme_info

字段类型说明
share_urlstring视频的抖音分享链接。
share_infoobject分享视频时使用的信息。
share_info.share_urlstring分享视频时使用的链接。
share_info.share_titlestring分享视频时使用的标题。
share_info.share_descstring分享视频时使用的说明文本。
text_extraarray | null作品文本关联的话题标签与提及的账号列表,可能为 null。
text_extra[]object一项文本标注。
text_extra[].typeinteger抖音返回的文本标注类型编码。
text_extra[].hashtag_idstring标注表示话题标签时,对应的话题标签 ID。
text_extra[].hashtag_namestring被标注的话题标签名称。
text_extra[].user_idstring标注提及用户时,对应的抖音账号 ID。
text_extra[].sec_uidstring被提及用户的抖音备用账号标识。
text_extra[].is_commerceboolean抖音是否将该话题标签标记为商业内容。
cha_listarray | null与作品关联的话题或挑战列表,可能为 null。
cha_list[]object一个话题或挑战。
cha_list[].cidstring抖音话题或挑战的 ID。
cha_list[].cha_namestring话题或挑战的名称。
cha_list[].descstring话题或挑战的说明。
cha_list[].is_commerceboolean抖音是否将该话题或挑战标记为商业内容。
相关搜索3 个字段

data.business_data[].data

字段类型说明
related_word_listarray结果卡片包含相关搜索时返回的推荐词列表。
related_word_list[]object一条相关搜索建议。
related_word_list[].related_wordstring推荐的相关搜索词。
其他字段2 个字段
字段路径类型说明
data.business_data[]object搜索结果列表中的一张卡片。
data.business_data[].dataobject结果卡片的内容,具体字段取决于卡片类型。

响应示例 ​

正在加载响应示例…