获取音乐搜索

浏览跨平台的已注册社交数据接口,然后深入查看完整参考文档

API 文档douyinSearch获取音乐搜索

获取音乐搜索

接口用途

  • 获取抖音 App 中音乐内容的搜索结果。
  • 支持关键词、排序方式、筛选条件等
POST/openapi/api/v1/douyin/search/fetch_music_search

价格:价格暂不可用 · 实际扣费按免费额度及账户折扣结算

鉴权

所有 API 请求都需要 Bearer 项目 Token,请在 Authorization 请求头中传入

Authorization headerAuthorization: Bearer YOUR_API_TOKEN

请求参数

  • keyword: 搜索关键词,例如 "游戏背景音乐"
  • cursor: 翻页游标(首次请求传 0,翻页时使用上次响应的 cursor)
  • sort_type: 排序方式
    • 0: 综合排序
    • 1: 最多点赞
    • 2: 最新发布
  • publish_time: 发布时间筛选
    • 0: 不限
    • 1: 最近一天
    • 7: 最近一周
    • 180: 最近半年
  • filter_duration: 视频时长筛选
    • 0: 不限
    • 0-1: 1 分钟以内
    • 1-5: 1-5 分钟
    • 5-10000: 5 分钟以上
  • content_type: 内容类型筛选
    • 0: 不限
    • 1: 视频
    • 2: 图片
    • 3: 文章
  • search_id: 搜索ID(分页时使用)
参数名位置 / 类型必填说明示例
keywordbody / string否
  • 关键词 / Keyword
cursorbody / integer否
  • 偏移游标,用于翻页,从上一次请求返回的响应中获取 / Offset cursor for pagination, obtained from the last response
sort_typebody / string否
  • 排序方式:0=综合排序 1=最多点赞 2=最新发布 / Sort type: 0=Comprehensive, 1=Most Likes, 2=Latest
publish_timebody / string否
  • 发布时间筛选:0=不限 1=最近一天 7=最近一周 180=最近半年 / Publish time filter: 0=Unlimited, 1=Last day, 7=Last week, 180=Last half year
filter_durationbody / string否
  • 视频时长过滤:0=不限 0-1=一分钟以内 1-5=一到五分钟 5-10000=五分钟以上 / Video duration filter: 0=Unlimited, 0-1=Within 1 minute, 1-5=1 to 5 minutes, 5-10000=More than 5 minutes
content_typebody / string否
  • 内容类型:0=不限 1=视频 2=图片 3=文章 / Content type: 0=All, 1=Video, 2=Picture, 3=Article
search_idbody / string否
  • 搜索ID,用于翻页,从上一次请求返回的响应中获取 / Search ID for pagination, obtained from the last response
backtracebody / string否
  • 翻页回溯标识,用于翻页,从上一次请求返回的响应中获取 / Backtrace for pagination, obtained from the last response

调用示例

curl -X POST "https://api.trmesh.com/openapi/api/v1/douyin/search/fetch_music_search" \
  -H "Authorization: Bearer sdc_your_project_token"

返回字段

字段名类型说明示例
musicunknown
  • List of music search results
id_strunknown
  • Music ID (as string)
titleunknown
  • Music title
authorunknown
  • Music author's nickname
albumunknown
  • Album name (if any)
play_url.url_listunknown
  • List of music play URLs
durationunknown
  • Duration in seconds
cover_thumb.url_listunknown
  • List of thumbnail cover URLs
cover_medium.url_listunknown
  • List of medium-sized cover URLs
cover_large.url_listunknown
  • List of large-sized cover URLs
user_countunknown
  • Number of videos using this music
is_originalunknown
  • Whether it is original music
is_commerce_musicunknown
  • Whether it is commercial music
lyric_urlunknown
  • Lyrics file URL (if available)
strong_beat_url.url_listunknown
  • Beat timing file URLs
tagsunknown
  • Music tags
artistsunknown
  • List of associated artists (if any)
artist_nameunknown
  • Artist name
uidunknown
  • Artist UID
cover_color_hsvunknown
  • Dominant HSV color of the cover
can_background_playunknown
  • Whether background playback is supported

公共响应外层

响应状态、请求标识和数据等公共字段

字段名类型说明示例
codeinteger
  • HTTP status code | HTTP状态码
request_idstring | null
  • 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 | null
  • Link to the API Swagger documentation for this endpoint | 此端点的 API Swagger 文档链接
cache_messagestring | null
  • Cache message (EN-US) | 缓存消息 (English)
cache_message_zhstring | null
  • Cache message (ZH-CN) | 缓存消息 (中文)
cache_urlstring | null
  • The URL to access the cached result | 访问缓存结果的 URL
routerstring
  • The endpoint that generated this response | 生成此响应的端点
paramsunknown
  • The parameters used in the request | 请求中使用的参数
dataunknown | null
  • The response data | 响应数据

错误码与限流说明

除了成功返回,这里也说明鉴权失败、限流和数据服务异常时的标准行为

状态码含义说明
200成功请求处理完成,返回标准结果包裹。
401未授权缺少令牌、令牌无效或登录状态已失效。
429触发限流请求速率超过令牌、用户或套餐的限制。
502服务暂不可用网关未获取到可用结果,建议稍后重试。
下一步

刚开始使用 API?阅读接入指南,或查看更多示例