# 抖音 用某段音乐的作品 API (douyin.music_posts)

- Canonical page: [https://everyinfra.com/douyin-api/music_posts](https://everyinfra.com/douyin-api/music_posts?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "douyin", "action": "music_posts", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: list
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=douyin&action=music_posts

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| music_id | not declared | yes | not declared | 抖音音乐 ID，纯数字，取自作品 music.id 或 music_detail；也收 douyin.com/music/<ID> 链接。 |
| limit | integer (1–) | no | not declared | 这次调用最多返回的条数，整数，至少为 1；不传按默认值，实际返回可能少于这个数。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| media_type | 媒体类型。 |
| video_url | 视频播放地址（带签名、会过期，要留存请及时下载）；图文笔记或来源没给时为 null。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| collect_count | 收藏数。null 表示不公开，不等于 0。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_douyin_id | 作者抖音号。 |
| author_bio | 作者主页简介（search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts 行上）。 |
| author_avatar_url | 作者头像链接：search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts 行上是博主的，live_room 上是主播的，comments 行上是评论者的。 |
| author_follower_count | 作者粉丝数。null 表示不公开。 |
| author_following_count | 作者关注数（search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts 行上）。 |
| author_like_count | 作者主页获赞总数（search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts / transcript）。 |
| author_video_count | 作者作品总数（search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts 行上）。 |
| author_is_verified | 作者是否认证（search / user_posts / video / posts_batch / related_posts / mix_posts / music_posts 行上；live_room 上是主播是否认证；comments 行上是评论者是否认证）。 |
| cover_image_url | 封面图链接：search / user_posts / posts_batch / related_posts / mix_posts / music_posts / media_links 是作品封面，music_search / music_detail 是音乐封面，billboard_topic_hot 是话题配图，user_mixes 是合集封面，live_room 是直播间封面；带签名的会过期。 |
| video_width | 视频画面宽度（像素）。 |
| video_height | 视频画面高度（像素）。 |
| video_bitrates | 各清晰度播放地址：[{quality（清晰度名）, bitrate（码率，bps）, fps, is_h265（是否 H.265 编码）, width, height（像素）, url}]，来源没给的项不出现；地址带签名、会过期（见 video_url_expires_at）。 |
| has_watermark | 平台对这条作品视频文件的水印标记（true 表示带水印）。 |
| duration_sec | 视频时长（秒）。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| hashtags | 正文里的话题标签数组，按出现顺序；没有时不出现这个字段。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| music | 作品背景音乐：id、title（曲名）、author（演唱/作者）、is_original（是否原声）、duration_sec（秒）、cover_url、play_url（音频地址，可能会过期）；没有音乐信息时没有这个键。 |
| location | 作品定位的地点（POI）：id、name、category（地点分类）、address、district、city、province、country、city_code、latitude、longitude、cover_url、popularity_text（如 327人想去）、view_count、post_count（该地点下的作品数）、collect_count、visitor_count；作品没带定位时没有这个键。 |
| image_urls | 图片链接数组，按平台展示顺序；没有图片时不出现这个字段。 |
| is_deleted | 作品已被删除时为 true；抖音在作品行上标了才有这个键。 |
| is_private | 作品仅自己可见（私密）时为 true；抖音在作品行上标了才有这个键。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| music_post_count | 抖音记的用了这段音乐的作品数（music_posts），每行相同；music_posts 只给抖音展示的一小部分，通常少得多。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "douyin",
  "action": "music_posts",
  "params": {
    "music_id": "7699717253151558410"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "douyin",
        "action": "music_posts",
        "params": {
            "music_id": "7699717253151558410",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "douyin",
  "action": "music_posts",
  "results": [
    {
      "id": …,
      "url": …,
      "text": …,
      "media_type": …,
      "video_url": …,
      "like_count": …,
      "comment_count": …,
      "share_count": …,
      "collect_count": …,
      "author_name": …,
      "author_id": …,
      "author_douyin_id": …,
      "author_bio": …,
      "author_avatar_url": …,
      "author_follower_count": …,
      "author_following_count": …,
      "author_like_count": …,
      "author_video_count": …,
      "author_is_verified": …,
      "cover_image_url": …,
      "video_width": …,
      "video_height": …,
      "video_bitrates": …,
      "has_watermark": …,
      "duration_sec": …,
      "duration_seconds": …,
      "hashtags": …,
      "posted_at": …,
      "title": …,
      "music": …,
      "location": …,
      "image_urls": …,
      "is_deleted": …,
      "is_private": …,
      "platform": …,
      "music_post_count": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=douyin
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
