@ikenxuan/amagi

快手 API

快手平台 API 参考文档

快手 API

快手平台的所有 API 方法参考。

调用形式与单次请求配置

Client 中的绑定 Fetcher 使用 client.kuaishou.fetcher.method(options, requestConfig?)。第二个参数只作用于当前调用,并与 Client 的实例级请求配置合并;单次配置优先,headers 会单独合并。显式提供大写 headers.Cookie 时,它也会替换本次底层调用的 cookie 参数。

直接导出的裸 Fetcher 使用 kuaishouFetcher.method(options, cookie?, requestConfig?)。这里没有实例级配置,第三个参数会直接透传到当前请求。amagi.kuaishouFetcher 与该命名导出是同一个裸 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.kuaishou.fetcher.fetchVideoWork({
  photoId: '3xqxxxxxx',
  typeMode: 'strict'
})
参数类型必填说明
photoIdstring是作品 ID
typeMode'strict' | 'loose'否类型模式

fetchWorkComments

获取作品评论数据。

import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.kuaishou.fetcher.fetchWorkComments({
  photoId: '3xqxxxxxx'
})
参数类型必填说明
photoIdstring是作品 ID

fetchUserProfile

获取用户主页聚合数据。

import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.kuaishou.fetcher.fetchUserProfile({
  principalId: 'KPL704668133',
  typeMode: 'strict'
})
参数类型必填说明
principalIdstring是用户主页 principalId
typeMode'strict' | 'loose'否类型模式

fetchUserWorkList

获取用户公开视频列表。

import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.kuaishou.fetcher.fetchUserWorkList({
  principalId: 'KPL704668133',
  count: 12,
  pcursor: '',
  typeMode: 'strict'
})
参数类型必填说明
principalIdstring是用户主页 principalId
countnumber否每页数量,默认 12
pcursorstring否分页游标,首屏可传空串
typeMode'strict' | 'loose'否类型模式

fetchLiveRoomInfo

获取直播间聚合数据。

import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.kuaishou.fetcher.fetchLiveRoomInfo({
  principalId: 'KPL704668133',
  typeMode: 'strict'
})
参数类型必填说明
principalIdstring是直播间 principalId
typeMode'strict' | 'loose'否类型模式

fetchEmojiList

获取 Emoji 列表。

import amagi from '@ikenxuan/amagi'
const client = amagi({ cookies: { bilibili: '', douyin: '', kuaishou: '', xiaohongshu: '' } })
const result = await client.kuaishou.fetcher.fetchEmojiList({})

使用示例

获取视频信息

import amagi from '@ikenxuan/amagi'
const client = amagi({
  cookies: {
    bilibili: '',
    douyin: '',
    kuaishou: 'did=xxx; ...',
    xiaohongshu: ''
  }
})

const result = await client.kuaishou.fetcher.fetchVideoWork({
  photoId: '3xqxxxxxx'
})

if (result.success) {
  console.log(result.data)
}

工具集

URL 拼接器

import { kuaishouUtils } from '@ikenxuan/amagi'

// 获取结构化请求描述对象
const request = kuaishouUtils.kuaishouApiUrls.videoWork({
  photoId: '3xqxxxxxx'
})

live_api 签名

import { kuaishouUtils } from '@ikenxuan/amagi'

const request = kuaishouUtils.kuaishouApiUrls.userInfoById({
  principalId: 'KPL704668133'
})

const signed = kuaishouUtils.sign.signLiveApiRequest(request, 'kwfv1=your_cookie_value')

注意事项

快手接口需要有效的 Cookie,部分接口可能需要登录状态才能获取完整数据。
  • 快手的 photoId 可以从分享链接中提取
  • 快手的 principalId 可以从用户主页或直播间 URL 末段提取
  • 评论数据可能需要登录 Cookie 才能获取
  • 建议设置合理的请求间隔,避免触发风控

最后更新于 2026-09-24

On this page