哔哩哔哩 API - 用户发布视频 (V2)
获取特定哔哩哔哩用户发布的视频列表,包括视频元数据、封面图片和互动指标。
典型用例:
- 监控创作者的内容更新和发布模式。
- 构建用户特定的视频目录用于分析。
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | API 的访问令牌。 |
uid | query | string | 是 | 哔哩哔哩用户ID (UID)。 |
param | query | string | 否 | 来自先前响应的分页参数。 |
代码示例
💡 环境说明
默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择。
bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE"text
我想使用 Just One API 提供的“用户发布视频 (V2)”接口。
接口地址: https://api.justoneapi.com/api/bilibili/get-user-video-list/v2
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/bilibili-apis/user-published-videos-v2-zh.json
请求参数说明:
- token (query): API 的访问令牌。 (必填)
- uid (query): 哔哩哔哩用户ID (UID)。 (必填)
- param (query): 来自先前响应的分页参数。
返回格式: JSON
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 余额不足
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE"
response = requests.get(url)
print(response.json())js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/bilibili/get-user-video-list/v2?token=YOUR_API_KEY&uid=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;响应结果
json
{
"code": 0,
"data": {
"code": 0,
"message": "OK",
"ttl": 1,
"data": {
"episodic_button": {
"text": "播放全部",
"uri": "bilibili://music/playlist/spacepage/472747194?desc=1&offset=0&oid=0&order=time&page_type=1&playlist_..."
},
"order": [
{
"title": "最新发布",
"value": "pubdate"
}
],
"count": 91,
"item": [
{
"title": "【巫师】美国干伊朗02,藏着对我们的资本阴招儿",
"translated_title": "",
"translate_status": "",
"subtitle": "",
"tname": "财经商业",
"cover": "http://i0.hdslb.com/bfs/archive/ee2702eb7b94310391bc0a71a4112ece2f35ffe5.jpg",
"cover_icon": "",
"uri": "bilibili://video/116176164232467?cid=36474193273&history_progress=0&player_height=1080&player_preloa...",
"param": "116176164232467",
"goto": "av",
"length": "",
"duration": 474,
"is_popular": false,
"is_steins": false,
"is_ugcpay": false,
"is_cooperation": false,
"is_pgc": false,
"is_live_playback": false,
"is_pugv": false,
"is_fold": false,
"is_oneself": false,
"view_self_type": 0,
"play": 480257,
"danmaku": 705,
"ctime": 1772707693,
"ugc_pay": 0,
"author": "巫师财经",
"state": false,
"bvid": "BV1CYPCzWEi4",
"videos": 1,
"three_point": [
{
"type": "addtoview",
"icon": "https://i0.hdslb.com/bfs/activity-plat/static/0X5s0d3xaY.png",
"text": "添加至稍后再看",
"translate": null
}
],
"first_cid": 36474193273,
"cursor_attr": {
"is_last_watched_arc": false,
"rank": 0
},
"view_content": "48万",
"icon_type": 0,
"publish_time_text": "3月5日",
"cover_left_icon": "",
"cover_left_text": "",
"sub_title_icon": ""
}
],
"last_watched_locator": {
"display_threshold": 10,
"insert_ranking": 6,
"text": "定位至上次观看"
},
"has_next": true,
"has_prev": false
}
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
