🍿 随机视频
随机视频 API 接口文档
本接口用于随机获取视频资源,支持 JSON 标准返回及直接跳转模式, 适用于网站、小程序、APP 及第三方系统对接。
一、接口地址
https://你的域名/kwai/index.php
二、请求方式
GET
三、请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
type |
string | 否 | 返回格式:json(默认)或 jump |
四、返回示例
{
"status": "success",
"video_url": "https://example.com/video3.mp4",
"source": "Video API Service",
"request_time": "2026-03-03 18:25:41",
"response_time": "3.42 ms"
}
五、返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
status |
string | 接口状态:success 或 error |
video_url |
string | 随机视频链接地址 |
source |
string | 接口来源标识 |
request_time |
string | 接口请求时间 |
response_time |
string | 接口执行耗时(毫秒) |
六、HTTP 状态码说明
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功 |
| 400 | 参数错误 |
| 404 | 无视频数据 |
| 405 | 请求方式错误 |
| 500 | 服务器内部错误 |
| 503 | 视频资源异常 |
七、直接跳转模式
请求示例:
https://你的域名/kwai/index.php?type=jump
返回结果:
HTTP/1.1 302 Found Location: 视频地址
https://你的域名/kwai/index.php?type=jump
返回结果:
HTTP/1.1 302 Found Location: 视频地址
八、对接示例(PHP)
$json = file_get_contents("https://你的域名/kwai/index.php");
$data = json_decode($json, true);
if ($data['status'] === 'success') {
echo $data['video_url'];
}
九、更新记录
| 日期 | 内容 |
|---|---|
| 2026-03-03 | 接口初始版本发布 |
阅读:26