📡 视频API接口文档

基础URL: https://yun.400239.com/

返回格式: JSON / XML (RSS)

字符编码: UTF-8 / GBK(可通过参数切换)

请求方式: GET

编码参数: 在任何接口后添加 ?encoding=gbk 可获得GBK编码的返回数据

🔌 可用接口列表

JSON API - 所有分类
GET 📋 复制
获取所有视频分类信息
JSON API - 所有视频 带参数
GET 📋 复制
参数: page (页码,默认1), limit (每页数量,默认20), cid (分类ID,可选)
获取所有视频信息,支持分页和分类筛选
{ "code": 0, "msg": "success", "page": 1, "limit": 20, "total": 100, "count": 20, "data": [ { "id": 1, "name": "示例视频", "cid": 1, "addtime": 1698765432, "addtime_format": "2024-10-31 12:30:32", "size": 12345678, "size_format": "11.77 MB", "duration": 360, "duration_format": "06:00", "status": 1, "status_text": "转码完成", "play_url": "http://example.com/play/1", "m3u8_url": "http://example.com/video/m3u8/...", "pic_url": "http://example.com/video/m3u8/.../1.jpg", "gif_url": "http://example.com/video/m3u8/.../1.gif", "preview_url": "http://example.com/video/m3u8/2025/11/01/abc12345/preview_123.mp4", "preview_enabled": true } ] }
JSON API - 单个视频详情
GET 📋 复制
获取指定ID的视频详细信息
RSS Feed - 最新视频 带参数
GET 📋 复制
参数: limit (数量,默认20), cid (分类ID,可选)
获取最新视频的RSS订阅源
JSON API - 完整数据
GET 📋 复制
获取所有分类和所有视频的完整数据

📝 使用示例

JavaScript (Ajax)

$.ajax({ url: '/index.php/api/videos.html?page=1&limit=10', type: 'GET', dataType: 'json', success: function(response) { if(response.code === 0) { console.log('视频列表:', response.data); } } });

PHP (cURL)

$url = '/index.php/api/all.html'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); print_r($data);

Python

import requests url = '/index.php/api/categories.html' response = requests.get(url) data = response.json() print(data)

🔤 字符编码说明

UTF-8 编码(默认)

// 默认返回 UTF-8 编码 { "code": 0, "msg": "success", "encoding": "utf-8", ... }

GBK 编码

添加 encoding=gbk 参数后,返回的数据将使用 GBK 编码,适用于需要GBK编码的老系统或特定应用场景。
// 返回 GBK 编码(Content-Type: application/json; charset=gbk) { "code": 0, "msg": "success", "encoding": "gbk", ... }

编码参数组合使用

// UTF-8 (默认) /index.php/api/videos.html?page=1&limit=10 // GBK 编码 /index.php/api/videos.html?page=1&limit=10&encoding=gbk // RSS with GBK /index.php/api/rss.html?encoding=gbk // 单个视频 with GBK /index.php/api/video/1.html?encoding=gbk

📊 状态码说明

code: 0 - 请求成功

code: 1 - 请求失败或出错

status: 0 - 等待转码

status: 1 - 转码完成

status: 2 - 转码失败

encoding - 返回数据中包含当前编码信息

API 文档 | 豆芽视频 | 2025

返回首页