# 抖音 链接识别 API (douyin.resolve_links)

- Canonical page: [https://everyinfra.com/douyin-api/resolve_links](https://everyinfra.com/douyin-api/resolve_links?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "douyin", "action": "resolve_links", "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=resolve_links

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| text | not declared | yes | not declared | 一段文字（例如整段分享口令），从里面认出抖音的视频、用户、音乐、合集、直播间链接和 ID。 |
| limit | integer (1–) | no | not declared | 这次调用最多返回的条数，整数，至少为 1；不传按默认值，实际返回可能少于这个数。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| matched_text | 文字里认出来的那一段原文（resolve_links）。 |
| match_type | 认出来的是什么形式（resolve_links）：link 链接、id 纯 ID 等。 |
| resource_type | 认出来的东西是哪一类（resolve_links）：video 视频、user 用户、music 音乐、mix 合集、live 直播间等。 |
| resource_id | 认出来的那个东西的 ID（resolve_links）：视频 ID、secUid、音乐 ID 等，可直接传给对应能力。 |
| handle | 认出来的是用户时的抖音号或名字（resolve_links）；其余情况没有。 |
| url | 该记录在原平台上的可访问链接。 |
| needs_expansion | 是否是短链、还要展开才知道指向什么（resolve_links）；为 true 时 resource_id 可能为空。 |
| id_created_at | 从 ID 本身推出来的创建时间（resolve_links，ISO 8601，UTC）：抖音的视频 ID 里带着发布时间。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## 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": "resolve_links",
  "params": {
    "text": "https://www.douyin.com/video/7539330955225484584"
  }
}'
```

```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": "resolve_links",
        "params": {
            "text": "https://www.douyin.com/video/7539330955225484584",
        },
    },
    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": "resolve_links",
  "results": [
    {
      "matched_text": …,
      "match_type": …,
      "resource_type": …,
      "resource_id": …,
      "handle": …,
      "url": …,
      "needs_expansion": …,
      "id_created_at": …,
      "platform": …
    }
  ],
  "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
