# 微信视频号视频解析 API Documentation

> 传入微信视频号分享链接，同步返回标题、封面、视频直链、作者与互动数据。成功解析扣 2 点，失败不扣费。

## Overview

This document describes how to call the **微信视频号视频解析** API.

- **Model / path slug**: `video/weixin`
- **Task type**: `sync` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/57`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `GET|POST https://apis.xiaobao.ink/api/video/weixin`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `GET / POST`
- **Note**: This endpoint accepts both GET query parameters and POST form/JSON body.

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `url` | Yes | 微信视频号分享链接 |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
https://apis.xiaobao.ink/api/video/weixin?key=你的密钥&url=视频号分享链接
```

## Details

## 接口说明：

同步解析**微信视频号**分享链接，立即返回标题、描述、封面、视频直链、作者与互动数据。支持完整 URL，以及带链接的分享口令（自动提取其中的 http(s) 地址）。解析失败不扣费。

本接口仅提供链接元数据解析，不存储、不复制、不分发原始内容。解析结果版权归原作者及原平台所有，仅供个人备份、内容审核、数据分析、学术研究等合理使用。

**计费：**每次成功解析扣 `2` 点；参数错误或解析失败不扣费。

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json 或 application/x-www-form-urlencoded |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| key | 是 | string | 你的密钥 | 平台 API 密钥 |
| url | 是 | string | https://... | 视频号分享链接，最大 2048 字符；兼容 content、link；可粘贴带网址的分享口令 |

GET / POST / JSON 均可。

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 状态码，200 表示成功 |
| msg | string | 状态信息 |
| data.platform | string | 固定 weixin_channels |
| data.type | string | 内容类型，如 video |
| data.title | string | 标题 |
| data.desc | string | 描述 |
| data.video_url | string | 视频直链 |
| data.cover_url | string | 封面地址 |
| data.quality | string | 画质说明 |
| data.author | object | 作者 name / id / avatar |
| data.author_name | string | 作者昵称 |
| data.video_backup | array | 备选清晰度列表 |
| data.stats | object | 点赞/评论/转发/播放 |
| data.request_url | string | 本次解析的链接 |

## Response Example

```json
{
    "code": 200,
    "msg": "解析成功",
    "data": {
        "platform": "weixin_channels",
        "type": "video",
        "title": "示例标题",
        "desc": "示例描述",
        "video_url": "https://你的域名/video.mp4",
        "cover_url": "https://你的域名/cover.jpg",
        "quality": "原画",
        "author": {
            "name": "作者昵称",
            "id": "xxx",
            "avatar": "https://你的域名/avatar.jpg"
        },
        "author_name": "作者昵称",
        "author_id": "xxx",
        "author_avatar": "https://你的域名/avatar.jpg",
        "video_backup": [
            {
                "label": "H.264 原画",
                "quality": "原画",
                "url": "https://你的域名/video.mp4",
                "format": "mp4",
                "codec": "h264"
            }
        ],
        "stats": {
            "like_count": 365,
            "comment_count": 26,
            "share_count": 1490,
            "play_count": 0
        },
        "request_url": "https://..."
    }
}
```

## Error Codes

| 业务码 | 说明 |
| --- | --- |
| 200 | 解析成功 |
| 400 | 参数错误或未能解析到有效内容 |
| 403 | 认证失败，请检查 key |
| 500 | 服务暂时繁忙或配置异常 |

## Usage Flow

1. Obtain your API Key from the console
2. Call the endpoint with `key` and required parameters
3. Parse the JSON (or binary) response according to the examples above

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
