抖音 API
抖音平台 API 参考文档
抖音 API
抖音平台的所有 API 方法参考。
调用形式与单次请求配置
Client 中的绑定 Fetcher 使用 client.douyin.fetcher.method(options, requestConfig?)。第二个参数只作用于当前调用,并与 Client 的实例级请求配置合并;单次配置优先,headers 会单独合并。显式提供大写 headers.Cookie 时,它也会替换本次底层调用的 cookie 参数。
直接导出的裸 Fetcher 使用 douyinFetcher.method(options, cookie?, requestConfig?)。这里没有实例级配置,第三个参数会直接透传到当前请求。amagi.douyinFetcher 与该命名导出是同一个裸 Fetcher。
当第三个参数显式设置 headers.Cookie 时,第二个参数必须传入完全相同的字符串字面量;接口支持匿名时,请写作 method(options, '', { headers: { Cookie: '' } })。字段名严格区分大小写,请使用 Cookie,不要使用 cookie。
Fetcher 方法
fetchVideoWork
获取视频作品数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchVideoWork({
aweme_id: '1234567890123456789',
typeMode: 'strict'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
aweme_id | string | 是 | 作品 ID |
typeMode | 'strict' | 'loose' | 否 | 类型模式 |
fetchImageAlbumWork
获取图集作品数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchImageAlbumWork({
aweme_id: '1234567890123456789'
})fetchSlidesWork
获取合辑作品数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchSlidesWork({
aweme_id: '1234567890123456789'
})fetchTextWork
获取文字作品数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchTextWork({
aweme_id: '1234567890123456789'
})parseWork
聚合解析作品(自动识别视频/图集/合辑)。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.parseWork({
aweme_id: '1234567890123456789'
})推荐使用
parseWork 方法,它会自动识别作品类型并返回相应数据。fetchWorkComments
获取作品评论数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchWorkComments({
aweme_id: '1234567890123456789',
number: 20,
cursor: 0
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
aweme_id | string | 是 | 作品 ID |
number | number | 否 | 获取数量 |
cursor | number | 否 | 分页游标 |
fetchCommentReplies
获取指定评论的回复数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchCommentReplies({
aweme_id: '1234567890123456789',
comment_id: '7123456789012345678',
number: 20,
cursor: 0
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
aweme_id | string | 是 | 作品 ID |
comment_id | string | 是 | 评论 ID |
number | number | 否 | 获取数量 |
cursor | number | 否 | 分页游标 |
fetchUserProfile
获取用户主页数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchUserProfile({
sec_uid: 'MS4wLjABAAAAxxxxxxxx'
})fetchUserVideoList
获取用户主页视频列表。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchUserVideoList({
sec_uid: 'MS4wLjABAAAAxxxxxxxx'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
sec_uid | string | 是 | 用户 sec_uid |
searchContent
搜索内容。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
// 综合搜索
const result = await client.douyin.fetcher.searchContent({
query: '关键词',
type: 'general',
number: 20
})
// 用户搜索
const userResult = await client.douyin.fetcher.searchContent({
query: '关键词',
type: 'user'
})
// 视频搜索
const videoResult = await client.douyin.fetcher.searchContent({
query: '关键词',
type: 'video'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
query | string | 是 | 搜索关键词 |
type | 'general' | 'user' | 'video' | 否 | 搜索类型 |
number | number | 否 | 获取数量 |
search_id | string | 否 | 搜索 ID(分页用) |
fetchSuggestWords
获取热点词/搜索建议。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchSuggestWords({
query: '关键词'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
query | string | 是 | 搜索关键词 |
fetchMusicInfo
获取音乐数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchMusicInfo({
music_id: '7123456789012345678'
})fetchLiveRoomInfo
获取直播间信息。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchLiveRoomInfo({
room_id: '7123456789',
web_rid: 'xxx'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
room_id | string | 是 | 直播间 ID |
web_rid | string | 是 | 直播间真实房间号 |
fetchDanmakuList
获取弹幕数据。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchDanmakuList({
aweme_id: '1234567890123456789',
duration: 60000,
start_time: 0,
end_time: 60000
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
aweme_id | string | 是 | 作品 ID |
duration | number | 是 | 视频时长(毫秒) |
start_time | number | 否 | 开始时间(毫秒) |
end_time | number | 否 | 结束时间(毫秒) |
requestLoginQrcode
申请登录二维码。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.requestLoginQrcode({
verify_fp: 'verify_xxx'
})| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
verify_fp | string | 是 | fp 指纹 |
fetchEmojiList
获取 Emoji 列表。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchEmojiList({})fetchDynamicEmojiList
获取动态表情列表。
import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.douyin.fetcher.fetchDynamicEmojiList({})最后更新于 2026-09-24