视频响应
使用 url 播放或下载视频,images 固定为空数组。
一个接口自动识别普通视频和图文作品。响应中的 type 是业务分流依据:视频返回 video,图集返回 gallery。
https://video-bak.mubaiyun.xyz/api/parse?url={抖音链接}请求方法为 GET,响应编码为 UTF-8,Content-Type 为 application/json。
| 参数 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
url | string | 是 | 抖音分享短链、视频链接或图文链接。调用方应先提取分享文字中的 URL。 | https://v.douyin.com/xxx/ |
输入真实链接直接请求当前 API,结果会在下方显示。
使用 url 播放或下载视频,images 固定为空数组。
遍历 images 获取全部图片,url 固定为空字符串。
{
"code": 200,
"type": "video",
"videoId": "7520000000000000000",
"title": "作品标题",
"author": "作者昵称",
"url": "https://video-cdn.example.com/video.mp4",
"cover": "",
"images": [],
"imageCount": 0,
"sourceUrl": "https://www.iesdouyin.com/share/video/752.../",
"cached": false
}{
"code": 200,
"type": "gallery",
"videoId": "7662259898261030499",
"title": "#周末去哪儿 #昆明旅游",
"author": "作者昵称",
"url": "",
"cover": "https://p3-sign.douyinpic.com/cover.webp",
"images": [
{
"url": "https://p3-sign.douyinpic.com/image-1.webp",
"width": 880,
"height": 1168
}
],
"imageCount": 1,
"sourceUrl": "https://www.iesdouyin.com/share/note/766.../",
"cached": false
}| 字段 | 类型 | 适用类型 | 说明 |
|---|---|---|---|
code | integer | 全部 | 业务状态码。200 成功,400 参数错误,500 解析失败。 |
type | string | 全部 | video、gallery 或 error。调用方应优先判断此字段。 |
videoId | string | 视频/图集 | 抖音作品数字 ID。字段名为兼容旧版保留,图集同样返回。 |
title | string | 视频/图集 | 作品标题或描述。上游缺失时可能为“未知标题”。 |
author | string | 视频/图集 | 作者昵称。上游缺失时可能为“未知作者”。 |
url | string | 视频 | 视频播放/下载直链。图集响应中为空字符串。 |
cover | string | 视频/图集 | 封面地址。当前图集为首图,视频可能为空。 |
images | array | 图集 | 图片对象数组,视频响应中固定为空数组。 |
images[].url | string | 图集 | 原始图片地址。地址包含有效期,建议按需使用,不要永久存储。 |
images[].width | integer | 图集 | 图片原始宽度,单位像素。 |
images[].height | integer | 图集 | 图片原始高度,单位像素。 |
imageCount | integer | 视频/图集 | 图片数量。视频固定为 0。 |
sourceUrl | string | 视频/图集/错误 | 短链接重定向后的抖音作品页,用于追踪来源。 |
cached | boolean | 视频/图集 | 是否命中服务端缓存。图集当前固定为 false。 |
error | string | 错误 | 可直接展示给开发者的错误原因。 |
url 参数,或链接不是有效的抖音域名。{
"code": 400,
"type": "error",
"error": "请提供 url 参数"
}code 表示业务状态,HTTP 状态通常为 200。接入时不要只判断 HTTP 状态。curl --get \ --data-urlencode "url=https://v.douyin.com/xxxx/" \ "https://video-bak.mubaiyun.xyz/api/parse"
const shareUrl = 'https://v.douyin.com/xxxx/';
const endpoint = new URL('https://video-bak.mubaiyun.xyz/api/parse');
endpoint.searchParams.set('url', shareUrl);
const data = await fetch(endpoint).then(r => r.json());
if (data.code !== 200) throw new Error(data.error);
if (data.type === 'video') {
console.log(data.url);
} else if (data.type === 'gallery') {
data.images.forEach(image => console.log(image.url));
}import requests
response = requests.get(
'https://video-bak.mubaiyun.xyz/api/parse',
params={'url': 'https://v.douyin.com/xxxx/'},
timeout=45,
)
data = response.json()
if data['code'] != 200:
raise RuntimeError(data['error'])
media_urls = (
[data['url']] if data['type'] == 'video'
else [image['url'] for image in data['images']]
)code === 200,再按 type 分流,最后读取 url 或 images。媒体 CDN 地址可能过期,不建议长期持久化。解析耗时受抖音上游网络影响,客户端超时建议设置为 45 秒。