From 70eb85210189c3b0a29ebaeb0480436b85a3f2ae Mon Sep 17 00:00:00 2001 From: Kro Date: Wed, 10 Jul 2024 04:40:36 -0700 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=BC=80=E9=80=9A?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=20(#1050)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 开通直播间API --- docs/live/manage.md | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/docs/live/manage.md b/docs/live/manage.md index e8b59b7..9aac690 100644 --- a/docs/live/manage.md +++ b/docs/live/manage.md @@ -1,5 +1,83 @@ # 直播间管理 +## 开通直播间 + +> https://api.live.bilibili.com/xlive/app-blink/v1/preLive/CreateRoom + +*请求方式:POST* + +认证方式:Cookie(SESSDATA) + +鉴权方式:Cookie中`bili_jct`的值正确并与`csrf`相同 + +**正文参数( application/x-www-form-urlencoded ):** +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------- | ---- | ------------------------ | ------ | -------------------- | +| platform | str | 客户端? | 必要 | 默认值web | +| visit_id | str | 未知 | | 默认空 | +| csrf | str | CSRF Token(位于cookie) | 必要 | | +| csrf_token | str | CSRF Token(位于 cookie) | | | + + +**json回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ------ | -------- | ------------------------------------------------------ | +| code | num | 返回值 | 0:成功
1531193016:已经创建直播间~
-400:请求错误 | +| ttl | str | 错误信息 | 默认为1 | +| message | str | 错误信息 | 默认为0 | +| data | array | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------- | ----- | ---------------- | ---------------------- | +| roomID | str | 直播间房间号 | 创建成功返回直播间号 | + +**示例:** + +开通直播间 + +```shell +curl 'https://api.live.bilibili.com/xlive/app-blink/v1/preLive/CreateRoom' \ +--data-urlencode 'platform=web' \ +--data-urlencode 'visit_id=' \ +--data-urlencode 'csrf=xxx' \ +--data-urlencode 'csrf_token=xxx' \ +-b 'SESSDATA=xxx;bili_jct=xx' +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "roomID": "1234" + } +} +``` + +```json +{ + "code": 1531193016, + "message": "已经创建直播间~", + "ttl": 1, + "data": { + "roomID": "" + } +} +``` + +
+ + + ## 更新直播间标题 > https://api.live.bilibili.com/room/v1/Room/update From 8cdf355f7e963168f6237f4fd9a405f13ce036b6 Mon Sep 17 00:00:00 2001 From: pillow02 <109227294+Pillow0-0@users.noreply.github.com> Date: Wed, 10 Jul 2024 21:45:56 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=E8=8E=B7=E5=8F=96=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=8E=A8=E8=8D=90=E5=88=97=E8=A1=A8=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E5=B7=B2=E6=9B=B4=E6=8D=A2=20(#1051)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/video/recommend.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/video/recommend.md b/docs/video/recommend.md index ea7e092..1af7ab5 100644 --- a/docs/video/recommend.md +++ b/docs/video/recommend.md @@ -1,8 +1,9 @@ # 视频推荐 -- [获取单视频推荐列表(web端)](#获取单视频推荐列表(web端)) -- [获取首页视频推荐列表(web端)](#获取首页视频推荐列表(web端)) -- [获取短视频模式视频列表](#获取短视频模式视频列表) +- [视频推荐](#视频推荐) + - [获取单视频推荐列表(web端)](#获取单视频推荐列表web端) + - [获取首页视频推荐列表(web端)](#获取首页视频推荐列表web端) + - [获取短视频模式视频列表](#获取短视频模式视频列表) --- ## 获取单视频推荐列表(web端) @@ -297,7 +298,7 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/related' \ ## 获取首页视频推荐列表(web端) -> https://api.bilibili.com/x/web-interface/index/top/rcmd +> https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd *请求方式:GET* From 8f419c1c9cdb9b32d6441c735647332ccdb21dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=80=E1=B4=8D=E1=B4=9B=E1=B4=8F=E1=B4=80=E1=B4=87?= =?UTF-8?q?=CA=80?= Date: Sat, 20 Jul 2024 17:53:25 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=20wbi=20=E7=AD=BE=E5=90=8D=E7=9A=84=20rust=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=20(#1059)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复获取 wbi 签名的 rust 实现 * chore: 在最上面的介绍里补上 Rust 的超链接 --- docs/misc/sign/wbi.md | 97 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 16 deletions(-) diff --git a/docs/misc/sign/wbi.md b/docs/misc/sign/wbi.md index 7c0d9c3..be86781 100644 --- a/docs/misc/sign/wbi.md +++ b/docs/misc/sign/wbi.md @@ -120,7 +120,7 @@ ## Demo -含 [Python](#Python)、[JavaScript](#JavaScript)、[Golang](#Golang)、[C#](#CSharp)、[Java](#Java)、[Swift](#Swift)、[C++](#CPlusPlus) 语言编写的 Demo 。 +含 [Python](#Python)、[JavaScript](#JavaScript)、[Golang](#Golang)、[C#](#CSharp)、[Java](#Java)、[Swift](#Swift)、[C++](#CPlusPlus)、[Rust](#Rust) 语言编写的 Demo 。 ### Python @@ -867,6 +867,7 @@ struct ResWbi { fn get_mixin_key(orig: &[u8]) -> String { MIXIN_KEY_ENC_TAB .iter() + .take(32) .map(|&i| orig[i] as char) .collect::() } @@ -891,23 +892,34 @@ fn get_url_encoded(s: &str) -> String { } // 为请求参数进行 wbi 签名 -fn encode_wbi(params: &mut Vec<(&str, String)>, (img_key, sub_key): (String, String)) -> String { - let mixin_key = get_mixin_key((img_key + &sub_key).as_bytes()); +fn encode_wbi(params: Vec<(&str, String)>, (img_key, sub_key): (String, String)) -> String { let cur_time = match SystemTime::now().duration_since(UNIX_EPOCH) { Ok(t) => t.as_secs(), Err(_) => panic!("SystemTime before UNIX EPOCH!"), }; + _encode_wbi(params, (img_key, sub_key), cur_time) +} + +fn _encode_wbi( + mut params: Vec<(&str, String)>, + (img_key, sub_key): (String, String), + timestamp: u64, +) -> String { + let mixin_key = get_mixin_key((img_key + &sub_key).as_bytes()); // 添加当前时间戳 - params.push(("wts", cur_time.to_string())); + params.push(("wts", timestamp.to_string())); // 重新排序 params.sort_by(|a, b| a.0.cmp(b.0)); - let query = params.iter().fold(String::from(""), |acc, (k, v)| { - acc + format!("{}={}&", get_url_encoded(k), get_url_encoded(v)).as_str() - }); - + // 拼接参数 + let query = params + .iter() + .map(|(k, v)| format!("{}={}", get_url_encoded(k), get_url_encoded(v))) + .collect::>() + .join("&"); + // 计算签名 let web_sign = format!("{:?}", md5::compute(query.clone() + &mixin_key)); - - query + &format!("w_rid={}", web_sign) + // 返回最终的 query + query + &format!("&w_rid={}", web_sign) } async fn get_wbi_keys() -> Result<(String, String), reqwest::Error> { @@ -922,23 +934,76 @@ async fn get_wbi_keys() -> Result<(String, String), reqwest::Error> { .await? .json::() .await?; + Ok(( + take_filename(wbi_img.img_url).unwrap(), + take_filename(wbi_img.sub_url).unwrap(), + )) +} - Ok((wbi_img.img_url, wbi_img.sub_url)) +fn take_filename(url: String) -> Option { + url.rsplit_once('/') + .and_then(|(_, s)| s.rsplit_once('.')) + .map(|(s, _)| s.to_string()) } #[tokio::main] async fn main() { - let urls = get_wbi_keys().await.unwrap(); - let mut params = vec![ + let keys = get_wbi_keys().await.unwrap(); + let params = vec![ ("foo", String::from("114")), ("bar", String::from("514")), ("baz", String::from("1919810")), ]; - - let query = encode_wbi(&mut params, urls); - + let query = encode_wbi(params, keys); println!("{}", query); } + +// 取自文档描述的测试用例 +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_get_filename() { + assert_eq!( + take_filename( + "https://i0.hdslb.com/bfs/wbi/7cd084941338484aae1ad9425b84077c.png".to_string() + ), + Some("7cd084941338484aae1ad9425b84077c".to_string()) + ); + } + + #[test] + fn test_get_mixin_key() { + let concat_key = + "7cd084941338484aae1ad9425b84077c".to_string() + "4932caff0ff746eab6f01bf08b70ac45"; + assert_eq!( + get_mixin_key(concat_key.as_bytes()), + "ea1db124af3c7062474693fa704f4ff8" + ); + } + + #[test] + fn test_encode_wbi() { + let params = vec![ + ("foo", String::from("114")), + ("bar", String::from("514")), + ("zab", String::from("1919810")), + ]; + assert_eq!( + _encode_wbi( + params, + ( + "7cd084941338484aae1ad9425b84077c".to_string(), + "4932caff0ff746eab6f01bf08b70ac45".to_string() + ), + 1702204169 + ), + "bar=514&foo=114&wts=1702204169&zab=1919810&w_rid=8f6f2b5b3d485fe1886cec6a0be8c5d4" + .to_string() + ) + } +} ``` ### Swift From 750dd6a924cbeff0c87e9db36d48f4c9fdd3e571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Session=E5=B0=8F=E8=83=A1?= <102411014+SessionHu@users.noreply.github.com> Date: Sat, 20 Jul 2024 18:38:49 +0800 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8E=A5=E5=8F=A3=20(#1056)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/dynamic/nav.md | 1167 +++++++++++++++++++++++++++++++++++ docs/message/msg.md | 40 +- docs/message/private_msg.md | 46 +- docs/misc/time_stamp.md | 3 +- docs/video/player.md | 2 +- docs/video/recommend.md | 891 +++++++++++++++++++++++--- 6 files changed, 2042 insertions(+), 107 deletions(-) create mode 100644 docs/dynamic/nav.md diff --git a/docs/dynamic/nav.md b/docs/dynamic/nav.md new file mode 100644 index 0000000..6500d11 --- /dev/null +++ b/docs/dynamic/nav.md @@ -0,0 +1,1167 @@ +# 获取导航栏动态 + +## 获取导航栏动态列表 + +> https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/nav + +*请求方式: GET* + +认证方式:Cookie(SESSDATA) + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| --------------- | ---- | ---------- | ------ | ----------------------- | +| update_baseline | num | 更新基线 | 非必要 | 获取新动态时使用 | +| offset | num | 分页偏移量 | 非必要 | 翻页时使用 | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | -------------------------- | +| code | num | 返回值 | 0: 成功
-101: 未登录 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------------- | ----- | ---------------------------- | -------------------------------------------------- | +| has_more | bool | 是否有更多数据 | | +| items | array | 数据数组 | | +| offset | str | 偏移量 | 等于`items`中最后一条记录的id
获取下一页时使用 | +| update_baseline | str | 更新基线 | 等于`items`中第一条记录的id_str | +| update_num | num | 本次获取获取到了多少条新动态 | 在更新基线以上的动态条数 | + +`data`对象中`items`数组中的对象: + +| 字段 | 类型 | 内容 | 备注 | +| -------- | ---- | -------- | ---------------------------- | +| author | obj | UP主 | 参见[module_author对象](all.md#data对象---items数组中的对象---modules对象---module_author对象) | +| cover | str | 封面URL | | +| id_str | str | 动态id | | +| pub_time | str | 发布时间 | 文字表述的相对时间 | +| rid | num | 关联id | 视频即aid | +| title | str | 标题 | | +| type | num | 动态类型 | 8: 视频 | +| visible | bool | 是否可见 | true:可见
false:不可见 | + +**示例:** + +获取导航栏动态列表 + +```shell +curl "https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/nav" \ + -b "SESSDATA=xxx" +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "has_more": true, + "items": [ + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/2b9ee4a9c99f1006f3c800c1317f7850ad6f3d0d.jpg", + "jump_url": "//space.bilibili.com/485703766/dynamic", + "mid": 485703766, + "name": "英伟达GeForce", + "official": { + "desc": "", + "role": 3, + "title": "英伟达GeForce官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 2000563200000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/adb599797dd171e2d3d6d012f448b49679258344.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/sGu57N6pgK.png", + "label_theme": "ten_annual_vip", + "path": "", + "text": "十年大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 7, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 1 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/d38b239af580eb199b4bbe55d2388cb603f6e917.jpg", + "id_str": "954636836111646759", + "jump_url": "//www.bilibili.com/video/BV181421k7bu/", + "pub_time": "1小时前", + "rid": 1556082150, + "title": "《异环》首曝丨即将支持 NVIDIA DLSS & 光线追踪技术", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/a220f26856924287c9dc4fa59c67ff38a2fcd20c.jpg", + "id_str": "954616624230433048", + "jump_url": "//www.bilibili.com/video/BV1RW421R7pE/", + "pub_time": "2小时前", + "rid": 1856122369, + "title": "【夏色祭×可波】《カタオモイ》请感受这份传达给你的心意【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/1b7e4eaf6696038bb96ff38c6d13a6b3778d6a7c.jpg", + "id_str": "954616624230432996", + "jump_url": "//www.bilibili.com/video/BV15Z421u7MX/", + "pub_time": "2小时前", + "rid": 1156047704, + "title": "Ready for my show!中日16位实力舞见高燃开场《唱》【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/5f22e930d0683b5e8d7a81f75b48fdb0c3a0f2e7.jpg", + "id_str": "954616624229384275", + "jump_url": "//www.bilibili.com/video/BV1hz421q7xP/", + "pub_time": "2小时前", + "rid": 1356132445, + "title": "阿梓×尔东和小明倾情演出《暁の車》带你重温高达经典旋律【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/04b46154e833ea1349c3302f9b9c188a45b016e9.jpg", + "id_str": "954616624228335667", + "jump_url": "//www.bilibili.com/video/BV1LS421R7sr/", + "pub_time": "2小时前", + "rid": 1506089543, + "title": "【Vox Akuma】声之恶魔低音爵士,深情演绎世界名曲【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i0.hdslb.com/bfs/archive/819d73ca191235e89a03c62889073d526b552fc2.jpg", + "id_str": "954616624033300612", + "jump_url": "//www.bilibili.com/video/BV1qM4m127wD/", + "pub_time": "2小时前", + "rid": 1306194854, + "title": "【RAB】全 部 逮 捕!萝 莉 控 的 末 日【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/01dd21a65db17705479ee4ee550a79856847264e.jpg", + "id_str": "954616624020717623", + "jump_url": "//www.bilibili.com/video/BV1rZ421K7yT/", + "pub_time": "2小时前", + "rid": 1156076206, + "title": "【可波×夏色祭】对你一见钟情啦!《5201314》开启绝赞告白【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/d79b28afc3273d5edb211d03ddc70c45999d57f7.jpg", + "fold": { + "ids": [ + "954616624019669009" + ], + "statement": "展开1条相关动态", + "type": 3, + "users": [] + }, + "id_str": "954616624019669032", + "jump_url": "//www.bilibili.com/video/BV1oE421c7XV/", + "pub_time": "2小时前", + "rid": 1656233700, + "title": "【洛天依】来自2024的《霜雪千年》还记否这一曲喜悲霜雪【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/93b809e050e639c9d8e8e379da96a4c2216ae755.jpg", + "jump_url": "//space.bilibili.com/36081646/dynamic", + "mid": 36081646, + "name": "洛天依", + "official": { + "desc": "", + "role": 2, + "title": "2023年度原创音乐、洛天依官方账号", + "type": 0 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1764777600000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/d79b28afc3273d5edb211d03ddc70c45999d57f7.jpg", + "id_str": "954616624019669009", + "jump_url": "//www.bilibili.com/video/BV1oE421c7XV/", + "pub_time": "2小时前", + "rid": 1656233700, + "title": "【洛天依】来自2024的《霜雪千年》还记否这一曲喜悲霜雪【BML2024单品】", + "type": 8, + "visible": false + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/cbbbb6e35c7680261a8a1fb3f582e04de14cbb50.jpg", + "id_str": "954616624002891844", + "jump_url": "//www.bilibili.com/video/BV1Fb421H7YQ/", + "pub_time": "2小时前", + "rid": 1806140865, + "title": "【ChiliChill】《我的悲伤是水做的》,描绘雨天的淡蓝色心情【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/b1f8744db9bad8a4a89bd9fa3fab0d128b347edb.jpg", + "id_str": "954616623998697505", + "jump_url": "//www.bilibili.com/video/BV12m421g759/", + "pub_time": "2小时前", + "rid": 1606234911, + "title": "成为挣脱《Cage》的小鸟,露米Lumi深情吟唱人类希望之歌【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/52e82dc68f3cbbb598d27437c33e996718e07924.jpg", + "id_str": "954616623995552002", + "jump_url": "//www.bilibili.com/video/BV181421k74U/", + "pub_time": "2小时前", + "rid": 1556081716, + "title": "型月组曲优雅串烧《若能看到明月》🌙🌙🌙【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i0.hdslb.com/bfs/archive/8558fe6746c43182b25f6a590f47b9673d47ba67.jpg", + "id_str": "954616623994503209", + "jump_url": "//www.bilibili.com/video/BV1jW421d7ce/", + "pub_time": "2小时前", + "rid": 1856192192, + "title": "Finana Ryugu超甜演绎童年回忆《プレパレード》最清纯的恋爱预演~【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i2.hdslb.com/bfs/archive/1ebd8cbd38eb9db9451df9978b20bee445d8fea0.jpg", + "id_str": "954616623993454708", + "jump_url": "//www.bilibili.com/video/BV1cw4m1Y7Zs/", + "pub_time": "2小时前", + "rid": 1106145687, + "title": "元气补给站《MORE!JUMP!MORE!》在BML舞台起跳!【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/bc1de2b7e27a5385e3e913fc552b86b744b49fb8.jpg", + "id_str": "954616623990308904", + "jump_url": "//www.bilibili.com/video/BV1QH4y1w7hC/", + "pub_time": "2小时前", + "rid": 1056107813, + "title": "【星瞳】华丽演绎《迷宮バタフライ》🦋一曲重温童年之梦【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i0.hdslb.com/bfs/archive/63617f9210ab2e996f75e8e2fb46c5dc73aeed35.jpg", + "id_str": "954616623980871832", + "jump_url": "//www.bilibili.com/video/BV1L1421b7XJ/", + "pub_time": "2小时前", + "rid": 1556117158, + "title": "奏响《葬送的破阵曲》,按捺不住战斗的心了!【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i1.hdslb.com/bfs/face/7cabb9c9576b4be8d52004d8a3a5450e5e062070.jpg", + "jump_url": "//space.bilibili.com/403748305/dynamic", + "mid": 403748305, + "name": "BML制作指挥部", + "official": { + "desc": "", + "role": 3, + "title": "Bilibili Macro Link官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1750176000000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i0.hdslb.com/bfs/archive/c3c470e309acef1d8c8f2ce79ed753f9bca50879.jpg", + "id_str": "954616623979823254", + "jump_url": "//www.bilibili.com/video/BV1uy411B7Ca/", + "pub_time": "2小时前", + "rid": 1956028036, + "title": "【猫MEME】转生成只能用MEME讲话的平凡上班族【BML2024单品】", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i0.hdslb.com/bfs/face/978ea07f22e54c2e62f01def8e815b59adacc5d0.jpg", + "jump_url": "//space.bilibili.com/407045223/dynamic", + "mid": 407045223, + "name": "二次元的中科院物理所", + "official": { + "desc": "", + "role": 6, + "title": "中国科学院物理研究所官方账号", + "type": 1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 1745769600000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png", + "label_theme": "annual_vip", + "path": "", + "text": "年度大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 3, + "status": 1, + "theme_type": 0, + "tv_due_date": 1626364800, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 0 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/056db2ac79801d853bebcd41c247788d8ccdb795.jpg", + "id_str": "954609313946533894", + "jump_url": "//www.bilibili.com/video/BV1Wz421q7n5/", + "pub_time": "3小时前", + "rid": 1356075945, + "title": "暑期不失约!第六季《科学公开课》震撼来袭!", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i0.hdslb.com/bfs/face/7efb679569b2faeff38fa08f6f992fa1ada5e948.webp", + "jump_url": "//space.bilibili.com/686127/dynamic", + "mid": 686127, + "name": "籽岷", + "official": { + "desc": "", + "role": 1, + "title": "2023百大UP主、知名游戏UP主", + "type": 0 + }, + "vip": { + "avatar_icon": { + "icon_resource": {}, + "icon_type": 1 + }, + "avatar_subscript": 1, + "avatar_subscript_url": "", + "due_date": 4845196800000, + "label": { + "bg_color": "#FB7299", + "bg_style": 1, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/c16005a5b39164b3536cbd45618a5edd597a1c51.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/Pzrd8zmpQD.png", + "label_theme": "hundred_annual_vip", + "path": "", + "text": "百年大会员", + "text_color": "#FFFFFF", + "use_img_label": true + }, + "nickname_color": "#FB7299", + "role": 15, + "status": 1, + "theme_type": 0, + "tv_due_date": 1692288000, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 2, + "vip_pay_type": 1 + } + }, + "cover": "http://i1.hdslb.com/bfs/archive/170237c4589a086afd7d62823765de1cc7306555.jpg", + "id_str": "954478850029387784", + "jump_url": "//www.bilibili.com/video/BV1Jz421q7JH/", + "pub_time": "11小时前", + "rid": 1356097140, + "title": "我的世界 冷门原版生物娘化 材质包", + "type": 8, + "visible": true + }, + { + "author": { + "face": "https://i0.hdslb.com/bfs/face/22e6b4f3c9199b6f4397f0d8df916872d677557b.jpg", + "jump_url": "//space.bilibili.com/625267185/dynamic", + "mid": 625267185, + "name": "零度解说", + "official": { + "desc": "", + "role": 0, + "title": "", + "type": -1 + }, + "vip": { + "avatar_icon": { + "icon_resource": {} + }, + "avatar_subscript": 0, + "avatar_subscript_url": "", + "due_date": 0, + "label": { + "bg_color": "", + "bg_style": 0, + "border_color": "", + "img_label_uri_hans": "", + "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png", + "img_label_uri_hant": "", + "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png", + "label_theme": "", + "path": "", + "text": "", + "text_color": "", + "use_img_label": true + }, + "nickname_color": "", + "role": 0, + "status": 0, + "theme_type": 0, + "tv_due_date": 0, + "tv_vip_pay_type": 0, + "tv_vip_status": 0, + "type": 0, + "vip_pay_type": 0 + } + }, + "cover": "http://i0.hdslb.com/bfs/archive/6f0397b546ba4da15fcd9a2e06cbcc1f68e5545c.jpg", + "id_str": "954376956212674594", + "jump_url": "//www.bilibili.com/video/BV141421b7sf/", + "pub_time": "昨天 20:30", + "rid": 1556122058, + "title": "快速提升上网速度!免费又好用,适用 Windows 10 /11,非常简单!!(2024) | 零度解说", + "type": 8, + "visible": true + } + ], + "offset": "954376956212674594", + "update_baseline": "954659517801431040", + "update_num": 0 + } +} +``` + +
diff --git a/docs/message/msg.md b/docs/message/msg.md index fa46f23..8b3e901 100644 --- a/docs/message/msg.md +++ b/docs/message/msg.md @@ -3,11 +3,19 @@ ## 未读消息数 > https://api.bilibili.com/x/msgfeed/unread +> https://api.vc.bilibili.com/x/im/web/msgfeed/unread (新接口) *请求方式:GET* 认证方式:Cookie(SESSDATA) +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| -------- | ---- | ---- | ------ | -------------------------- | +| build | num | 0 | 不必要 | 从新接口发现, 作用尚不明确 | +| mobi_app | str | web | 不必要 | 从新接口发现, 作用尚不明确 | + **json回复:** 根对象: @@ -19,23 +27,29 @@ | ttl | num | 1 | | | data | obj | 信息本体 | | -data 对象: +`data` 对象: -| 字段 | 类型 | 内容 | 备注 | -| ------- | ---- | -------------- | ------------ | -| at | num | 未读at数 | | -| chat | num | 0 | 作用尚不明确 | -| like | num | 未读点赞数 | | -| reply | num | 未读回复数 | | -| sys_msg | num | 未读系统通知数 | | -| up | num | UP主助手信息数 | | +| 字段 | 类型 | 内容 | 备注 | +| ------------- | ---- | -------------- | ---------------------- | +| at | num | 未读at数 | | +| chat | num | 0 | 作用尚不明确 | +| coin | num | 未读投币数 | | +| danmu | num | 未读弹幕数 | | +| favorite | num | 未读收藏数? | | +| like | num | 未读点赞数 | | +| recv_like | num | 未读点赞数 | | +| recv_reply | num | 未读回复数 | | +| reply | num | 未读回复数 | | +| sys_msg | num | 未读系统通知数 | | +| sys_msg_style | num | 1 | 仅新接口, 作用尚不明确 | +| up | num | UP主助手信息数 | | **示例:** 以下信息代表了未读点赞数为10,未读回复数为4,未读at消息数为3,未读系统通知数为2,UP主助手信息数为1 ```shell -curl 'https://api.bilibili.com/x/msgfeed/unread' \ +curl 'https://api.vc.bilibili.com/x/im/web/msgfeed/unread' \ -b 'SESSDATA=xxx' ``` @@ -50,9 +64,15 @@ curl 'https://api.bilibili.com/x/msgfeed/unread' \ "data": { "at": 3, "chat": 0, + "coin": 0, + "danmu": 0, + "favorite": 0, "like": 10, + "recv_like": 10, + "recv_reply": 4, "reply": 4, "sys_msg": 2, + "sys_msg_style": 1, "up": 1 } } diff --git a/docs/message/private_msg.md b/docs/message/private_msg.md index e3241f1..b325968 100644 --- a/docs/message/private_msg.md +++ b/docs/message/private_msg.md @@ -8,24 +8,37 @@ 认证方式:Cookie(SESSDATA) +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ----------- | ---- | ---- | ------ | ---- | +| build | num | 0 | 不必要 | ? | +| mobi_app | str | web | 不必要 | ? | +| unread_type | num | 0 | 不必要 | ? | + **json回复:** 根对象: | 字段 | 类型 | 内容 | 备注 | | ------- | ---- | -------- | --------------------------- | -| code | num | 返回值 | 0:成功
-6:账号未登录 | +| code | num | 返回值 | 0:成功
-101:账号未登录 | | message | str | 错误信息 | 默认为ok | | ttl | num | 1 | | | data | obj | 信息本体 | | `data` 对象: -| 字段 | 类型 | 内容 | 备注 | -| --------------- | ---- | -------------------- | ---- | -| unfollow_unread | num | 未关注用户未读私信数 | | -| follow_unread | num | 已关注用户未读私信数 | | -| _gt_ | num | 0 | | +| 字段 | 类型 | 内容 | 备注 | +| ----------------------- | ---- | ----------------------- | ---- | +| unfollow_unread | num | 未关注用户未读私信数 | | +| follow_unread | num | 已关注用户未读私信数 | | +| unfollow_push_msg | num | 未关注用户推送消息数? | | +| dustbin_push_msg | num | 已拦截的推送消息数? | | +| dustbin_unread | num | 已拦截的未读消息数? | | +| biz_msg_unfollow_unread | num | 未订阅的未读系统通知数? | | +| biz_msg_follow_unread | num | 已订阅的未读系统通知数? | | +| custom_unread | num | 自定义未读消息数? | | **示例:** @@ -41,14 +54,19 @@ curl 'https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread' \ ```json { - "code": 0, - "msg": "ok", - "message": "ok", - "data": { - "unfollow_unread": 1, - "follow_unread": 6, - "_gt_": 0 - } + "code": 0, + "msg": "ok", + "message": "ok", + "data": { + "unfollow_unread": 1, + "follow_unread": 6, + "unfollow_push_msg": 0, + "dustbin_push_msg": 0, + "dustbin_unread": 0, + "biz_msg_unfollow_unread": 0, + "biz_msg_follow_unread": 1, + "custom_unread": 0 + } } ``` diff --git a/docs/misc/time_stamp.md b/docs/misc/time_stamp.md index 4eb38f5..d4e6459 100644 --- a/docs/misc/time_stamp.md +++ b/docs/misc/time_stamp.md @@ -2,7 +2,8 @@ ## 获取当前时间戳 -> https://api.bilibili.com/x/report/click/now +> https://api.bilibili.com/x/report/click/now +> https://api.bilibili.com/x/click-interface/click/now *请求方式:GET* diff --git a/docs/video/player.md b/docs/video/player.md index 1d39959..fe0ff8c 100644 --- a/docs/video/player.md +++ b/docs/video/player.md @@ -13,7 +13,7 @@ web 播放器的信息接口,提供正常播放需要的元数据,包括: | aid | num | 稿件 avid | 必要 (可选) | aid 与 bvid 任选 | | bvid | str | 稿件 bvid | 必要 (可选) | aid 与 bvid 任选 | | cid | num | 稿件 cid | 必要 | | -| w_rid | str | 未知 | 不必要 | | +| w_rid | str | WBI 签名 | 不必要 | | | wts | num | 当前 unix 时间戳 | 不必要 | | diff --git a/docs/video/recommend.md b/docs/video/recommend.md index 1af7ab5..b203e50 100644 --- a/docs/video/recommend.md +++ b/docs/video/recommend.md @@ -1,11 +1,5 @@ # 视频推荐 -- [视频推荐](#视频推荐) - - [获取单视频推荐列表(web端)](#获取单视频推荐列表web端) - - [获取首页视频推荐列表(web端)](#获取首页视频推荐列表web端) - - [获取短视频模式视频列表](#获取短视频模式视频列表) ---- - ## 获取单视频推荐列表(web端) > https://api.bilibili.com/x/web-interface/archive/related @@ -304,61 +298,110 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/related' \ 认证方式:Cookie(SESSDATA) -最多获取14条推荐视频 +最多获取30条推荐视频,直播及推荐边栏 **url参数:** -| 参数名 | 类型 | 内容 | 必要性 | 备注 | -|--------------|-----|---------------------------|-----|------------------------------| -| fresh_type | num | 相关性 | 非必要 | 默认为3
值越大推荐内容越相关 | -| version | num | web端新旧版本:0为旧版本1为新版本 | 非必要 | 默认为0
1,0分别为新旧web端 | -| ps | num | pagesize 单页返回的记录条数默认为10或8 | 非必要 | 默认为10
当version为1时默认为8 | -| fresh_idx | num | 翻页相关 | 非必要 | 默认为1
与翻页相关 | -| fresh_idx_1h | num | 翻页相关 | 非必要 | 默认为1
与翻页相关 | +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +|---------------|------|------------------------|--------|-------------------------------------------------------| +| fresh_type | num | 相关性 | 非必要 | 默认为 4
值越大推荐内容越相关 | +| ps | num | 单页返回的记录条数 | 非必要 | 默认为 12, 留空即最大值为 30 | +| fresh_idx | num | 当前翻页号 | 非必要 | 以 1 开始 | +| fresh_idx_1h | num | 当前翻页号(一小时前?) | 非必要 | 以 1 开始, 默认与 fresh_idx 内容相同 | +| brush | num | 刷子? | 非必要 | 以 1 开始, 默认与 fresh_idx 内容相同 | +| fetch_row | num | 本次抓取的最后一行行号 | 非必要 | 1 递归加上本次抓取总行数 | +| web_location | num | 网页位置 | 非必要 | 主页为 1430650 | +| y_num | num | 普通列数 | 非必要 | 一行中视频,直播及广告数 | +| last_y_num | num | 总列数 | 非必要 | 普通列数 + 边栏列数 | +| feed_version | str | V8 | 非必要 | 作用尚不明确 | +| homepage_ver | num | 1 | 非必要 | 首页版本 | +| screen | str | 浏览器视口大小 | 非必要 | 水平在前垂直在后以减号分割 | +| seo_info | str | 空 | 非必要 | 作用尚不明确 | +| last_showlist | str | 上次抓取的视频av号列表 | 非必要 | av与数字间用下划线分隔, 若视频UP主已关注则中间再插入n | +| uniq_id | str | ??? | 非必要 | 作用尚不明确 | +| w_rid | str | WBI 签名 | 非必要 | 见[WBI 签名](../misc/sign/wbi.md) | +| wts | num | UNIX 时间戳 | 非必要 | 见[WBI 签名](../misc/sign/wbi.md) | **json回复:** 根对象: -| 字段 | 类型 | 内容 | 备注 | -|-------------|-------|------|----------------------| -| code | num | 返回值 | 0:成功
-400:请求错误 | -| message | str | 错误信息 | 默认为0 | -| ttl | num | 1 | | -| data | array | 推荐列表 | | -| userfeature | str | 用户功能 | | -| abtest | obj | 用户分组 | | +| 字段 | 类型 | 内容 | 备注 | +|-------------|------|----------|------------------------------| +| code | num | 返回值 | 0:成功
-400:请求错误 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | | | -`data`数组: +`data`对象: -| 项 | 类型 | 内容 | 备注 | -|-----| ---- |-----------| ---- | -| 0 | obj | 推荐视频1 | | -| n | obj | 推荐视频(n+1) | | -| …… | obj | …… | …… | -| 13 | obj | 推荐视频13 | | +| 字段 | 类型 | 内容 | 备注 | +|--------------------------|-------|-----------|--------------------------------| +| business_card | null | | | +| floor_info | null | | | +| item | array | 推荐列表 | | +| mid | num | 用户mid | 未登录为0 | +| preload_expose_pct | num | 0.5 | 用于预加载? | +| preload_floor_expose_pct | num | 0.5 | 用于预加载? | +| side_bar_column | array | 边栏列表? | 可参考字段 item 及对应功能文档 | +| user_feature | null | | | -`data`数组中的对象: +`data`对象中`item`数组中的对象: -基本同「[获取视频详细信息(web端)](info.md#获取视频详细信息(web端))」中的data对象 +| 字段 | 类型 | 内容 | 备注 | +|--------------------------|------|--------------------|-------------------------------------------| +| av_feature | null | | | +| business_info | obj | 商业推广信息 | 无为null, 此处无参考意义 | +| bvid | str | 视频bvid | | +| cid | num | 稿件cid | | +| dislike_switch | num | 1 | 显示不感兴趣开关? | +| dislike_switch_pc | num | 0 | 显示不感兴趣开关(PC)? | +| duraion | num | 视频时长 | | +| enable_vt | num | 0 | 作用尚不明确 | +| goto | num | 目标类型 | av: 视频
ogv: 边栏
live: 直播 | +| duraion | num | 视频时长 | | +| id | num | 视频aid / 直播间id | | +| is_followed | num | 已关注 | 0: 未关注
1: 已关注 | +| is_stock | num | 0 | 作用尚不明确 | +| ogv_info | null | | | +| owner | obj | UP主 | | +| pic | str | 封面 | | +| pic_4_3 | str | 封面(4:3) | | +| pos | num | 0 | 位置? | +| pubdate | num | 发布时间 | | +| rcmd_reason | obj | 推荐理由 | 直播等为null | +| room_info | obj | 直播间信息 | 普通视频等为null, 参见[直播](../live) | +| show_info | num | 展示信息 | 1: 普通视频
0: 直播 | +| stat | obj | 视频状态信息 | 直播等为null, 参见[视频基本信息](info.md) | +| title | str | 标题 | | +| track_id | str | 跟踪标识? | | +| uri | str | 目标页 URI | | +| vt_display | str | 空 | 作用尚不明确 | -`abtest`对象: +`item`数组中的对象中的`owner`对象: -| 字段 | 类型 | 内容 | 备注 | -|-------|-----|------|-----| -| group | str | 用户分组 | | +| 字段 | 类型 | 内容 | 备注 | +| face | str | 头像URL | | +| mid | num | UP主mid | | +| name | str | UP昵称 | | + +`item`数组中的对象中的`rcmd_reason`对象: + +| 字段 | 类型 | 内容 | 备注 | +| reason_type | num | 原因类型 | 0: 无
1: 已关注
3: 高点赞量 | +| content | str | 原因描述 | 当 reason_type 为 3 时存在 | **示例:** 获取新版web端首页推荐视频列表 ```shell -curl -G 'https://api.bilibili.com/x/web-interface/index/top/rcmd' \ ---data-urlencode 'fresh_type=3' \ ---data-urlencode 'version=1' \ ---data-urlencode 'ps=10' \ ---data-urlencode 'fresh_idx=1' \ ---data-urlencode 'fresh_idx_1h=1' +curl -G 'https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd' \ +--data-urlencode 'fresh_type=4' \ +--data-urlencode 'ps=12' \ +--data-urlencode 'fresh_idx=5' \ +--data-urlencode 'fresh_idx_1h=5' \ +--data-urlencode 'fetch_row=16' ```
@@ -366,47 +409,733 @@ curl -G 'https://api.bilibili.com/x/web-interface/index/top/rcmd' \ ```json { - "code": 0, - "message": "0", - "ttl": 1, - "data": { - "item": [ - { - "id": 511495739, - "bvid": "BV1Cu411z7mG", - "cid": 717978243, - "goto": "av", - "uri": "http://www.bilibili.com/video/BV1Cu411z7mG", - "pic": "http://i2.hdslb.com/bfs/archive/e05f487bc9f26baa568f10fe69a0e1ea5e0fbc23.jpg", - "title": "请大家助力我的梦想!为凑够10万赞,在街头唱《Be Crazy For Me》!", - "duration": 199, - "pubdate": 1652605500, - "owner": { - "mid": 1723817, - "name": "樱萍Apple", - "face": "http://i2.hdslb.com/bfs/face/6e0fa1bdbbf7e0dd929d968df3b57ca99d187e25.jpg" - }, - "stat": { - "view": 263169, - "like": 39871, - "danmaku": 543 - }, - "avfeature": "{\"ctr\":0.192554,\"wdur\":2.323159,\"duration\":213.318313,\"wdlks\":0.685926,\"multi_score_0\":0.452564,\"multi_score_1\":0.112414,\"multi_score_2\":0.03976,\"rankscore\":13.906487,\"av_play\":258890,\"av_like\":39224,\"av_coin\":7165,\"reason_type\":3,\"av_feature\":\"|real_matchtype -1 |s_e online_av2av_v2 |source_len 1 |m_k_w 0 \"}", - "isfollowed": 0, - "rcmdreason": { - "content": "3万点赞", - "reasontype": 3 - }, - "showinfo": 1, - "trackid": "web_pegasus_0.shylf-ai-recsys-1355.165525355529.398" - } - ...... - ], - "userfeature": "{\"enter_rank\":1500,\"is_fallback\":0,\"s_fresh_idx\":41,\"s_fresh_idx_session\":31,\"s_session_idx\":1,\"fresh_idx\":1,\"fresh_idx_1h\":1}", - "abtest": { - "group": "b" + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "item": [ + { + "id": 1354614895, + "bvid": "BV1Dz42117GZ", + "cid": 1548835687, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1Dz42117GZ", + "pic": "http://i1.hdslb.com/bfs/archive/b47154987b4c0f40a39779c09a9d485176d1238f.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/archive/b47154987b4c0f40a39779c09a9d485176d1238f.jpg", + "title": "做数学题总是抄错 | 看错 | 算错 怎么破?决定高考分数的这个非智力因素不容忽视", + "duration": 882, + "pubdate": 1715946937, + "owner": { + "mid": 374484802, + "name": "数学阮禾老师", + "face": "https://i1.hdslb.com/bfs/face/4df57e4b48b04206bce7572831688741580ca0e1.jpg" + }, + "stat": { + "view": 48250, + "like": 2959, + "danmaku": 433, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1255924089, + "bvid": "BV1DJ4m1u7Mp", + "cid": 1600833978, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1DJ4m1u7Mp", + "pic": "http://i0.hdslb.com/bfs/archive/5068d860e8bbc37679ece933aa8e6d8428cfb5c1.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-07-01-1145021255924089_1612_gener.jpg", + "title": "人类这种生物,看到按钮就会按下去。", + "duration": 326, + "pubdate": 1719805500, + "owner": { + "mid": 5616993, + "name": "马夫鱼33", + "face": "https://i0.hdslb.com/bfs/face/4c2af23046147e91ce5a4af3375464fdcf1956e6.jpg" + }, + "stat": { + "view": 667067, + "like": 28529, + "danmaku": 483, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "content": "2万点赞", + "reason_type": 3 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1306020278, + "bvid": "BV1rM4m117Ry", + "cid": 1608959606, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1rM4m117Ry", + "pic": "http://i0.hdslb.com/bfs/archive/49f62c70f17d0afe00e5e620dd366c68149c780e.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/archive/49f62c70f17d0afe00e5e620dd366c68149c780e.jpg", + "title": "Axios 前后端对接教程|HTTP", + "duration": 352, + "pubdate": 1720440325, + "owner": { + "mid": 260736087, + "name": "三分钟实验室", + "face": "https://i0.hdslb.com/bfs/face/6172aa089ed0b26ffffb72018422eb4280d4da41.jpg" + }, + "stat": { + "view": 7527, + "like": 365, + "danmaku": 1, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1755972439, + "bvid": "BV1g4421D7qn", + "cid": 1597039275, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1g4421D7qn", + "pic": "http://i2.hdslb.com/bfs/archive/35ee2ffaab4206d17893a3f48cdf512b4f028fdc.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-26-21354756381755972439_16_12_5326_crop.jpg", + "title": "《我爱发明》里那些抽象发明 歹徒兴奋床!", + "duration": 659, + "pubdate": 1719408945, + "owner": { + "mid": 348989367, + "name": "沫子瞪片", + "face": "https://i0.hdslb.com/bfs/face/a2131d38a2ea73f16ff25e61dbeb40377233f552.jpg" + }, + "stat": { + "view": 1540767, + "like": 65409, + "danmaku": 5383, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1055953358, + "bvid": "BV1jH4y1w7A6", + "cid": 1598484848, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1jH4y1w7A6", + "pic": "http://i1.hdslb.com/bfs/archive/accdb655b4f2bef665e6fdedb4de28de2feda078.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-28-12560692491055953358_16_12_2438_crop.jpg", + "title": "为什么一个数的5次方个位数是自己!", + "duration": 327, + "pubdate": 1719550565, + "owner": { + "mid": 483522694, + "name": "火星课堂", + "face": "https://i1.hdslb.com/bfs/face/fe751f0d7062c8e8adcef501390d48330fac0514.jpg" + }, + "stat": { + "view": 244673, + "like": 5406, + "danmaku": 210, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": { + "id": 0, + "contract_id": "", + "res_id": 1055953358, + "asg_id": 0, + "pos_num": 0, + "name": "", + "pic": "", + "litpic": "", + "url": "", + "style": 0, + "agency": "", + "label": "", + "intro": "", + "creative_type": 0, + "request_id": "1721098961752q172a25a216a162q1363", + "src_id": 5637, + "area": 0, + "is_ad_loc": true, + "ad_cb": "", + "title": "", + "server_type": 0, + "cm_mark": 0, + "stime": 0, + "mid": "", + "activity_type": 0, + "epid": 0, + "sub_title": "", + "ad_desc": "", + "adver_name": "", + "null_frame": false, + "pic_main_color": "", + "card_type": 0, + "business_mark": null, + "inline": { + "inline_use_same": 0, + "inline_type": 0, + "inline_url": "", + "inline_barrage_switch": 0 + }, + "operater": "", + "jump_target": 0, + "show_urls": null, + "click_urls": null + }, + "is_stock": 1, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1763571437, + "bvid": "", + "cid": 0, + "goto": "live", + "uri": "https://live.bilibili.com/1763571437", + "pic": "http://i0.hdslb.com/bfs/live/new_room_cover/f1787ef2ce4a2a031fb4a6a63b62d15493268d71.jpg", + "pic_4_3": "", + "title": "【新V】今天不要再把自己笨哭了", + "duration": 0, + "pubdate": 0, + "owner": { + "mid": 3546712666802274, + "name": "伊柒璇儿_鹤熙冠", + "face": "https://i0.hdslb.com/bfs/face/3e0ff3d7d53b9ac1a2d90ea563e22d3f70ad28cc.jpg" + }, + "stat": null, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": null, + "show_info": 0, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": { + "room_id": 1763571437, + "uid": 3546712666802274, + "live_status": 1, + "show": { + "short_id": 0, + "title": "【新V】今天不要再把自己笨哭了", + "cover": "http://i0.hdslb.com/bfs/live/new_room_cover/f1787ef2ce4a2a031fb4a6a63b62d15493268d71.jpg", + "keyframe": "http://i0.hdslb.com/bfs/live-key-frame/keyframe07161101001763571437k9l40v.jpg", + "popularity_count": 8539, + "tag_list": null, + "live_start_time": 0, + "live_id": 0, + "hidden_online": false + }, + "area": { + "area_id": 0, + "area_name": "虚拟日常", + "parent_area_id": 9, + "parent_area_name": "虚拟主播", + "old_area_id": 0, + "old_area_name": "", + "old_area_tag": "", + "area_pk_status": 0, + "is_video_room": false + }, + "watched_show": { + "switch": true, + "num": 168, + "text_small": "168", + "text_large": "168人看过", + "icon": "https://i0.hdslb.com/bfs/live/a725a9e61242ef44d764ac911691a7ce07f36c1d.png", + "icon_location": "", + "icon_web": "https://i0.hdslb.com/bfs/live/8d9d0f33ef8bf6f308742752d13dd0df731df19c.png" + } + }, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1855792572, + "bvid": "BV16s421T7CU", + "cid": 1587596195, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV16s421T7CU", + "pic": "http://i2.hdslb.com/bfs/archive/1b9d9799260a075b094212bf79e3d7ccb9e04087.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-19-14044883851855792572_16_12_7260_crop.jpg", + "title": "压缩蚊件.zip", + "duration": 66, + "pubdate": 1718777086, + "owner": { + "mid": 173947574, + "name": "好奇五先生", + "face": "https://i2.hdslb.com/bfs/face/1c69fff12a2d0d50e71931cef0486ab919a818a2.jpg" + }, + "stat": { + "view": 951633, + "like": 22930, + "danmaku": 932, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1405866842, + "bvid": "BV11r421F7E8", + "cid": 1589772517, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV11r421F7E8", + "pic": "http://i2.hdslb.com/bfs/archive/50b1bb8d227d17a3b6195e80128ab295d152d3be.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-20-2148551405866842_1612_gener.jpg", + "title": "【音游推荐】暑期音游推荐,不同基础都可入坑", + "duration": 311, + "pubdate": 1718891332, + "owner": { + "mid": 592146708, + "name": "Qc天水", + "face": "https://i0.hdslb.com/bfs/face/2998a9e762aa07559b2acf54234f07979c959ffe.jpg" + }, + "stat": { + "view": 278997, + "like": 6698, + "danmaku": 303, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1055540151, + "bvid": "BV1in4y197U4", + "cid": 1582190043, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1in4y197U4", + "pic": "http://i2.hdslb.com/bfs/archive/9a366971fadd6e4dfd1813c42b180c8779038627.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-15-18004087071055540151_16_12_7856_crop.jpg", + "title": "我把裁判罚下场了", + "duration": 217, + "pubdate": 1718445600, + "owner": { + "mid": 475304452, + "name": "生姜蛋包饭", + "face": "https://i1.hdslb.com/bfs/face/40feee36c71f7f53931854fc54c88d530360b1a7.jpg" + }, + "stat": { + "view": 678085, + "like": 62171, + "danmaku": 832, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "content": "6万点赞", + "reason_type": 3 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1505823466, + "bvid": "BV1vS421d7No", + "cid": 1596567774, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1vS421d7No", + "pic": "http://i2.hdslb.com/bfs/archive/b2b19b067cdbf7dd93be5fc01009e72c20572184.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-26-1241021505823466_1612_gener.jpg", + "title": "AI 视频:两小儿辩日", + "duration": 138, + "pubdate": 1719376858, + "owner": { + "mid": 589397373, + "name": "宝玉xp", + "face": "https://i0.hdslb.com/bfs/face/c2c29f6e1bb9b0860241f0df4d2cdea8242ab5d2.jpg" + }, + "stat": { + "view": 1216188, + "like": 54839, + "danmaku": 194, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1055744039, + "bvid": "BV1Zn4y1Q7zj", + "cid": 1575814128, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1Zn4y1Q7zj", + "pic": "http://i0.hdslb.com/bfs/archive/5288cf0830e49de414084c4168b11033b08f8507.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-06-09-17404720501055744039_16_12_294_crop.jpg", + "title": "【诺子】重新“看见”世界是一种什么样的感觉?", + "duration": 579, + "pubdate": 1717926045, + "owner": { + "mid": 10276136, + "name": "诺子喵呜", + "face": "https://i2.hdslb.com/bfs/face/7e6846ed5619b945c888b8f8db5000469f6353ff.jpg" + }, + "stat": { + "view": 1016467, + "like": 97886, + "danmaku": 979, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + }, + { + "id": 1706215690, + "bvid": "BV1tT421k7By", + "cid": 1611364587, + "goto": "av", + "uri": "https://www.bilibili.com/video/BV1tT421k7By", + "pic": "http://i1.hdslb.com/bfs/archive/cd3308109e8726fe4147dd25ed7ca0dbeeda1dc1.jpg", + "pic_4_3": "http://i0.hdslb.com/bfs/aistory/2024-07-11-00194836761706215690_16_12_3934_crop.jpg", + "title": "谷歌翻译20遍《河中石兽》泌尿系统", + "duration": 145, + "pubdate": 1720628387, + "owner": { + "mid": 1030835113, + "name": "象哥嘎", + "face": "https://i1.hdslb.com/bfs/face/aa0ae89fa72dab7b8bc082433769b1768f51c3dc.jpg" + }, + "stat": { + "view": 78600, + "like": 3437, + "danmaku": 328, + "vt": 0 + }, + "av_feature": null, + "is_followed": 0, + "rcmd_reason": { + "reason_type": 0 + }, + "show_info": 1, + "track_id": "web_pegasus_4.router-web-pegasus-1554782-5c89895477-smhn8.1721098961744.133", + "pos": 0, + "room_info": null, + "ogv_info": null, + "business_info": null, + "is_stock": 0, + "enable_vt": 0, + "vt_display": "", + "dislike_switch": 1, + "dislike_switch_pc": 0 + } + ], + "side_bar_column": [ + { + "id": 25502, + "goto": "comic", + "track_id": "", + "pos": 1, + "card_type": "漫画", + "card_type_en": "comic", + "cover": "http://i0.hdslb.com/bfs/manga-static/5e410bf6f73ff87f87b543e4b918de5f024652e8.jpg", + "url": "https://manga.bilibili.com/detail/mc25502", + "title": "头文字D", + "sub_title": "", + "duration": 0, + "stats": null, + "room_info": null, + "styles": [ + "游戏竞技" + ], + "comic": { + "comic_id": 25502, + "title": "头文字D", + "horizontal_cover": "http://i0.hdslb.com/bfs/manga-static/5e410bf6f73ff87f87b543e4b918de5f024652e8.jpg", + "square_cover": "http://i0.hdslb.com/bfs/manga-static/da660f6274730af82d557f21a6247d4f6b1e300b.jpg", + "vertical_cover": "http://i0.hdslb.com/bfs/manga-static/64df8b860d2bf6bf2edd0426b4aefbff25b51386.jpg", + "is_finish": 1, + "status": 0, + "last_ord": 724, + "total": 724, + "release_time": "", + "last_short_title": "番外05", + "discount_type": 0, + "recommendation": "秋名山下坡最快的AE86神话!", + "last_read_ep_id": 0, + "latest_ep_short_title": "", + "style": [ + "游戏竞技" + ], + "author_name": [ + "重野秀一 ", + "讲谈社" + ], + "allow_wait_free": false, + "type": 0, + "rank": null, + "operate_cover": "", + "rookie_type": 0 + }, + "producer": null, + "source": "", + "av_feature": null, + "is_rec": 0, + "is_finish": 0, + "is_started": 0, + "is_play": 0, + "enable_vt": 0, + "vt_display": "" + }, + { + "id": 47800, + "goto": "ogv", + "track_id": "", + "pos": 2, + "card_type": "番剧", + "card_type_en": "bangumi", + "cover": "https://i0.hdslb.com/bfs/bangumi/image/1c61f75b571fffb8c5a2bd0396b49ce3529776f4.png", + "url": "https://www.bilibili.com/bangumi/play/ss47800", + "title": "铁甲小宝 重制版 中文配音", + "sub_title": "童年经典回归!", + "duration": 1382000, + "stats": { + "follow": 116644, + "view": 10864687, + "danmaku": 42428, + "reply": 11448, + "coin": 18904, + "series_follow": 209046, + "series_view": 17474247, + "likes": 61376, + "favorite": 116644 + }, + "room_info": null, + "new_ep": { + "id": 824212, + "index_show": "更新至第30话", + "cover": "http://i0.hdslb.com/bfs/archive/e185c054588945a1de6648ff7fb5001852df39f4.png", + "title": "30", + "long_title": "巨大机器来袭!!", + "pub_time": "2024-07-15 18:00:01", + "duration": 1382000, + "day_of_week": 1 + }, + "styles": [ + "日常", + "热血", + "搞笑", + "原创", + "特摄" + ], + "comic": null, + "producer": [ + { + "mid": 928123, + "name": "哔哩哔哩番剧", + "type": 3, + "is_contribute": 1 + } + ], + "source": "", + "av_feature": null, + "is_rec": 0, + "is_finish": 0, + "is_started": 1, + "is_play": 1, + "horizontal_cover_16_9": "https://i0.hdslb.com/bfs/bangumi/image/ec5065dc0e88417abd4792d5caa96dacc99d1d51.png", + "horizontal_cover_16_10": "https://i0.hdslb.com/bfs/bangumi/image/5cc132e336cc72e6521bba928d8a0e50bd5a6d34.png", + "enable_vt": 0, + "vt_display": "" + }, + { + "id": 48020, + "goto": "ogv", + "track_id": "", + "pos": 3, + "card_type": "国创", + "card_type_en": "guochuang", + "cover": "https://i0.hdslb.com/bfs/bangumi/image/fcb176fcbf5a66fd122fa99f9fdf2cabf22468bb.png", + "url": "https://www.bilibili.com/bangumi/play/ss48020", + "title": "不白吃古诗词漫游记 第二季", + "sub_title": "古诗词这动人的浪漫", + "duration": 179000, + "stats": { + "follow": 2173495, + "view": 325366, + "danmaku": 110, + "reply": 208, + "coin": 443, + "series_follow": 2208624, + "series_view": 3322752487, + "likes": 8794, + "favorite": 2173495 + }, + "room_info": null, + "new_ep": { + "id": 830238, + "index_show": "更新至第7话", + "cover": "http://i0.hdslb.com/bfs/archive/6db74bc8ab2670181562314a24abe525cebb7c76.jpg", + "title": "7", + "long_title": "王维当个官怎么还郁闷了?", + "pub_time": "2024-07-15 19:00:00", + "duration": 179000, + "day_of_week": 1 + }, + "styles": [ + "少儿", + "历史", + "原创", + "古风" + ], + "comic": null, + "producer": [], + "source": "", + "av_feature": null, + "is_rec": 0, + "is_finish": 0, + "is_started": 1, + "is_play": 1, + "horizontal_cover_16_9": "https://i0.hdslb.com/bfs/bangumi/image/f19013ddd7f87b0e03df10feccc4a61a3a43774a.png", + "horizontal_cover_16_10": "https://i0.hdslb.com/bfs/bangumi/image/966553b199829aae7e47882edbe053463ee85276.png", + "enable_vt": 0, + "vt_display": "" + } + ], + "business_card": null, + "floor_info": null, + "user_feature": null, + "preload_expose_pct": 0.5, + "preload_floor_expose_pct": 0.5, + "mid": 645769214 } - } } ``` From 18c1efbc102ae6b44c8f5314c90e5e64f0d926cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Session=E5=B0=8F=E8=83=A1?= <102411014+SessionHu@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:03:52 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20bili=5Fticket=20=E7=AE=97=E6=B3=95?= =?UTF-8?q?=20Java=20=E5=AE=9E=E7=8E=B0=20=E5=8F=8A=20=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=A1=A5=E5=85=85=20=E5=8F=8A=20=E9=94=99=E8=AF=AF=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20(#1061)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 空间头图及拼写错误修正 * feat(fav/info.md): code 11010 * fix(misc/sign/wbi.md): java extra params * feat(misc/sign/bili_ticket.md): description and java demo * feat(video_ranking/dynamic.md): 分区视频相关接口 * fix(video_ranking/dynamic.md): 未关闭的标签 * feat(README.md): 补充链接 * feat(clientinfo/ip.md): 查询任意 IP 地址的归属地 * feat: get buvid3 buvid4 from api * feat: new error code & format * feat(misc/picture.md): 图片格式化更多规则 --- README.md | 4 + docs/clientinfo/ip.md | 93 ++++++- docs/fav/info.md | 2 +- docs/live/manage.md | 2 +- docs/misc/buvid3_4.md | 48 ++++ docs/misc/bvid_desc.md | 22 +- docs/misc/device_identity.md | 2 +- docs/misc/picture.md | 32 ++- docs/misc/sign/bili_ticket.md | 124 +++++++++- docs/misc/sign/wbi.md | 2 - docs/misc/time_stamp.md | 2 +- docs/user/space.md | 349 ++++++++++++++++++++++++-- docs/video/action.md | 4 +- docs/video_ranking/dynamic.md | 448 +++++++++++++++++++++++++++++++++- 14 files changed, 1078 insertions(+), 56 deletions(-) create mode 100644 docs/misc/buvid3_4.md diff --git a/README.md b/README.md index b716ae5..3ffdecf 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,13 @@ B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接 - [x] [APP API 签名](docs/misc/sign/APP.md)(`appkey`与`sign`) - [x] [已知的 APPKey](docs/misc/sign/APPKey.md) - [x] [Wbi 签名](docs/misc/sign/wbi.md)(`wts`与`w_rid`) + - [ ] [bili_ticket](docs/misc/sign/bili_ticket.md) - [x] [公共错误码](docs/misc/errcode.md) - [x] [图片格式化](docs/misc/picture.md) - [x] [bvid 说明](docs/misc/bvid_desc.md) - [ ] [设备唯一标识BUVID](docs/misc/device_identity.md) +- [ ] [获取 buvid3 / buvid4](docs/misc/buvid3_4.md) - [ ] [gRPC API 接口定义](grpc_api) - [ ] [登录](docs/login) - [x] [登录操作 (人机认证)](docs/login/login_action) @@ -207,6 +209,7 @@ B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接 - [ ] 动态列表 - [x] [特定话题动态列表](docs/dynamic/tag_dynamics.md) - [ ] [动态内容](docs/dynamic/get_dynamic_detail.md) + - [ ] [导航栏动态](docs/dynamic/nav.md) - [ ] [相簿](docs/album) - [x] [基本信息](docs/album/info.md) - [x] [相簿列表](docs/album/list.md) @@ -357,6 +360,7 @@ OR Aifadian:[https://afdian.net/@ShakaiAneE](https://afdian.net/@ShakaiAneE) - [SocialSisterYi/bcut-asr](https://github.com/SocialSisterYi/bcut-asr): 使用必剪API的语音字幕识别 - [CzJam/Bili_Realtime_Data](https://github.com/CzJam/Bili_Realtime_Data): Bilibili粉丝与视频实时数据统计 - [kingwingfly/fav](https://github.com/kingwingfly/fav): 自动同步bili收藏夹、合集视频到本地的CLI工具(Rust实现,并提供一个文档测试完善的Rust风格的用于构建有状态爬虫的核心库) +- [linyuye/Bilibili_crawler](https://github.com/linyuye/Bilibili_crawler): 基于bilibili懒加载api爬取b站动态,视频等评论区 ### 其他 diff --git a/docs/clientinfo/ip.md b/docs/clientinfo/ip.md index 548ec02..d72633d 100644 --- a/docs/clientinfo/ip.md +++ b/docs/clientinfo/ip.md @@ -1,6 +1,6 @@ # 通过ip确定地理位置 -## 通过ip确定位置 +## 根据请求IP确定属地 > https://api.bilibili.com/x/web-interface/zone @@ -60,3 +60,94 @@ curl 'https://api.bilibili.com/x/web-interface/zone' ```
+ +## 查询任意 IP 地址的归属地 + +> https://api.live.bilibili.com/ip_service/v1/ip_service/get_ip_addr +> https://api.live.bilibili.com/client/v1/Ip/getInfoNew + +注: 两接口等效 + +*请求方式:GET* + +**URL参数:** + + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | -------- | ------ | ---- | +| ip | str | IP地址 | 不必要 | IPv4或IPv6地址不限, 留空与[根据请求IP确定地理位置](#根据请求ip确定地理位置)基本相同 | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------- | +| code | num | 返回值 | 0: 成功 | +| message | str | 错误信息 | 默认为空 | +| msg | str | 错误信息 | 同message | +| data | obj | 信息本体 | 出错时为空数组 | + +`data`对象: + +与[根据请求IP确定地理位置](#根据请求ip确定地理位置)回复的`data`对象基本相同, 但无 `country_code` 字段 + +**示例:** + +查询请求IP地址的归属地: + +```shell +curl -G 'https://api.live.bilibili.com/client/v1/Ip/getInfoNew' +``` + +
+查看响应示例: + + +```json +{ + "code": 0, + "msg": "", + "message": "", + "data": { + "addr": "104.28.156.113", + "country": "新加坡", + "province": "新加坡", + "city": "", + "isp": "cloudflare.com", + "latitude": "1.352083", + "longitude": "103.819836" + } +} +``` + +
+ +查询IP地址`8.8.8.8`的归属地: + +```shell +curl -G 'https://api.live.bilibili.com/ip_service/v1/ip_service/get_ip_addr' \ +--data-urlencode 'ip=8.8.8.8' +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "msg": "", + "message": "", + "data": { + "addr": "8.8.8.8", + "country": "GOOGLE.COM", + "province": "GOOGLE.COM", + "city": "", + "isp": "level3.com", + "latitude": "", + "longitude": "" + } +} +``` + +
diff --git a/docs/fav/info.md b/docs/fav/info.md index 84bce67..45008d9 100644 --- a/docs/fav/info.md +++ b/docs/fav/info.md @@ -22,7 +22,7 @@ | 字段 | 类型 | 内容 | 备注 | | ------- | ----------------------------- | -------- | --------------------------------------------------- | -| code | num | 返回值 | 0:成功
-400:请求错误
-403:访问权限不足 | +| code | num | 返回值 | 0:成功
-400:请求错误
-403:访问权限不足
11010: 内容不存在 | | message | str | 错误信息 | 默认为0 | | data | 有效时:obj
无效或:null | 信息本体 | | diff --git a/docs/live/manage.md b/docs/live/manage.md index 9aac690..319487f 100644 --- a/docs/live/manage.md +++ b/docs/live/manage.md @@ -161,7 +161,7 @@ curl 'https://api.live.bilibili.com/room/v1/Room/update' \ | 字段 | 类型 | 内容 | 备注 | | ------- | ---- | -------- | ------------------------------------------------------------ | -| code | num | 返回值 | 0:成功
65530:token错误(登录错误)
1:错误
60009:分区不存在
60013:非常抱歉,您所在的地区受实名认证限制无法开播
**(其他错误码有待补充)** | +| code | num | 返回值 | 0:成功
65530:token错误(登录错误)
1:错误
60009:分区不存在
60024: 目标分区需要人脸认证
60013:非常抱歉,您所在的地区受实名认证限制无法开播
**(其他错误码有待补充)** | | msg | str | 错误信息 | 默认为空 | | message | str | 错误信息 | 默认为空 | | data | obj | 信息本体 | | diff --git a/docs/misc/buvid3_4.md b/docs/misc/buvid3_4.md new file mode 100644 index 0000000..13d386e --- /dev/null +++ b/docs/misc/buvid3_4.md @@ -0,0 +1,48 @@ +# 获取 buvid3 / buvid4 + +## 游客获取 buvid3 / buvid4 + +> https://api.bilibili.com/x/frontend/finger/spi + +*请求方式: GET* + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | -------- | +| code | num | 返回值 | 0:成功 | +| message | str | 信息 | ok: 成功 | +| data | obj | 数据本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ------ | ---- | +| b_3 | str | buvid3 | 需手动存放至 cookie 中 | +| b_4 | str | buvid4 | 同上 | + +**示例:** + +注: 建议自行生成, 不要复制本处示例的 buvid3 / buvid4. + +```shell +curl -G 'https://api.bilibili.com/x/frontend/finger/spi' +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "data": { + "b_3": "D9656DA8-9BEF-F464-5B72-C4849AFD336379044infoc", + "b_4": "F6E0FD4B-520C-1902-4F7B-E461D8D1F5AB79044-024072309-666onEZSnlHVPjoRp4kDYg==" + }, + "message": "ok" +} +``` + +
diff --git a/docs/misc/bvid_desc.md b/docs/misc/bvid_desc.md index 486956f..2ed0fc8 100644 --- a/docs/misc/bvid_desc.md +++ b/docs/misc/bvid_desc.md @@ -248,10 +248,9 @@ print(av2bv(avid: 111298867365120)) print(bv2av(bvid: "BV1L9Uoa9EUx")) ``` - ### Java -``` +```java import java.math.BigInteger; /** @@ -266,8 +265,7 @@ public class AVBVConverter { private static final String DATA = "FcwAPNKTMug3GV5Lj7EJnHpWsx4tb8haYeviqBz6rkCy12mUSDQX9RdoZf"; - public static String av2bv(int aidParam) { - + public static String av2bv(long aidParam) { BigInteger aid = BigInteger.valueOf(aidParam); char[] bytes = {'B', 'V', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0'}; int bvIndex = bytes.length - 1; @@ -275,18 +273,14 @@ public class AVBVConverter { while (tmp.compareTo(BigInteger.ZERO) > 0) { bytes[bvIndex] = DATA.charAt(tmp.mod(BigInteger.valueOf(BASE)).intValue()); tmp = tmp.divide(BigInteger.valueOf(BASE)); - bvIndex -= 1; + bvIndex--; } swap(bytes, 3, 9); swap(bytes, 4, 7); - StringBuilder sb = new StringBuilder(bytes.length); - for (Character ch : bytes) { - sb.append(ch); - } - return sb.toString(); + return new String(bytes); } - public static int bv2av(String bvid) { + public static long bv2av(String bvid) { char[] bvidArr = bvid.toCharArray(); swap(bvidArr, 3, 9); swap(bvidArr, 4, 7); @@ -296,7 +290,7 @@ public class AVBVConverter { tmp = tmp.multiply(BigInteger.valueOf(BASE)).add(BigInteger.valueOf(DATA.indexOf(c))); } BigInteger xor = tmp.and(MASK_CODE).xor(XOR_CODE); - return xor.intValue(); + return xor.longValue(); } @@ -314,21 +308,17 @@ public class AVBVConverter { final int aid2 = 305988942; final String bv2 = "BV1aP411K7it"; - //av ==> bv assert av2bv(aid1).equals(bv1); assert av2bv(aid2).equals(bv2); - //bv ==>av assert bv2av(bv1) == aid1; assert bv2av(bv2) == aid2; } } - ``` - ### Golang ```go diff --git a/docs/misc/device_identity.md b/docs/misc/device_identity.md index 5fae7fd..0335848 100644 --- a/docs/misc/device_identity.md +++ b/docs/misc/device_identity.md @@ -2,7 +2,7 @@ ## 设备唯一标识 BUVID -注意区分于 Web 端的 buvid3, buvid4. +注意区分于 Web 端的 [buvid3, buvid4](buvid3_4.md). BUVID 在 APP 首次安装于某设备, 且首次启动时生成. diff --git a/docs/misc/picture.md b/docs/misc/picture.md index 01a51a5..b3c3f8a 100644 --- a/docs/misc/picture.md +++ b/docs/misc/picture.md @@ -1,18 +1,33 @@ # 图片格式化 -对于\*.hdslb.com/bfs下的图片文件都可以使用以下格式化参数 +对于 `*.hdslb.com/bfs` 下的图片文件都可以使用以下可选格式化参数. -> \*.hdslb.com/bfs/\*/\*.\[jpg/png/gif\]@{width}w\_{high}h\_{quality}q.{format} +使用 `@` 开始参数 (无论格式如何, 无论是否有参数, 通过计算 HASH 发现, 使用 `@` 均会导致返回图片不同), 多个参数以 `_` 分隔, 图片格式无需分隔且必须放在最后 -| 可选参数 | 含义 | 备注 | -| -------- | ---------------- | ---------------- | -| width | 图片最大限制宽度 | | -| high | 图片最大限制高度 | | -| quality | 图片质量百分比 | 仅限webp | -| format | 图片格式 | 仅限png/jpg/webp/[avg_color](#avg_color格式说明) | +参见: [#191](https://github.com/SocialSisterYi/bilibili-API-collect/issues/191) + +注: jpg 即 jpeg, 二者等效. 网页端常用 AVIF, WebP. + +| 参数 | 格式 | 含义 | 备注 | +| ---- | ------- | ---------------- | ---------------- | +| w | ${int}w | 图片最大限制宽度 | 范围 [1, 9223372036854775807] | +| h | ${int}h | 图片最大限制高度 | 范围 [1, 9223372036854775807] | +| s | ${int}s | 作用尚不明确 | 不影响输出结果, 范围 [1, 9223372036854775807] | +| e | ${int}e | 改变大小 | 0: 保留比例取其小, 1: 保留比例取其大, 2: 不保留原比例 | +| p | ${int}p | 缩放倍数 | 默认100, 范围 [1, 1000] | +| o | ${int}o | 作用尚不明确 | 不影响输出结果 范围 [0, 1] | +| q | ${int}q | 图片质量百分比 | 仅限webp/jpeg/avif | +| c | ${int}c | 裁切图片(如果宽高允许) | 0: 不裁切但会修改图片, 1: 上传时的预设规则(若无则右下), 2: 左上, 3: 右上 | +| f | ${int}f | 作用尚不明确 | [0, 1]: 不改变图片, 2: 会改变图片 | +| progressive | progressive | 图片编码方式 | 仅限 jpeg(无: baseline, 有: progressive)/png(无:non-interlaced, 有: interlaced) | +| ! | !${str} | 加载来源 | web-home-carousel-cover, header, web-dynamic, web-avatar-space-header, ... | +| . | .${str} | 图片格式 | 仅限 png/jpeg/webp/avif/[avg_color](#avg_color格式说明) | **示例:** +
+查看示例: + 原始图片 https://i1.hdslb.com/bfs/archive/e5fff1472bad1c0c6bcb3004205f9be23b58ffc0.jpg @@ -43,6 +58,7 @@ https://i1.hdslb.com/bfs/archive/e5fff1472bad1c0c6bcb3004205f9be23b58ffc0.jpg@1q ![](https://i1.hdslb.com/bfs/archive/e5fff1472bad1c0c6bcb3004205f9be23b58ffc0.jpg@1q.webp) +
## avg_color格式说明 diff --git a/docs/misc/sign/bili_ticket.md b/docs/misc/sign/bili_ticket.md index a9d40a9..6cfd5b2 100644 --- a/docs/misc/sign/bili_ticket.md +++ b/docs/misc/sign/bili_ticket.md @@ -1,8 +1,11 @@ -`bili_ticket` 目前没发现多少风控价值,但是暂且在这里提供一份示例。 +# BiliTicket + +## 简述 + +`bili_ticket` 位于请求头 Cookie 中, 非必需, 但存在可降低风控概率 由 [@aynuarance](https://github.com/aynuarance) 于 [#903](https://github.com/SocialSisterYi/bilibili-API-collect/issues/903) 提供的思路,根据时间戳使用 `hmac_sha256` 算法计算 `hexsign`。 - 是 [JWT 令牌](https://jwt.io/),有效时长为 259260 秒,即 3 天。 例如 `eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDI3NDI3NDYsImlhdCI6MTcwMjQ4MzQ4NiwicGx0IjotMX0.xQgtTAc41NA1gzvd9yKUPgucUy_DKcQj6OG1vj8V7ZA` @@ -14,7 +17,18 @@ } ``` -# Python 示例 +## 算法 + +1. 获取 UNIX 秒级时间戳存入变量如 `timestamp` +2. 计算变量 `hexsign` 值,使用 `hmac_sha256` 算法,密钥为 `XgwSnGZ1p`,消息为字符串 `"ts"` 与变量 `timestamp` 值拼接 +3. 构造请求参数,`key_id` 为 `ec02`,`hexsign` 为变量 `hexsign` 值,`context[ts]` 为变量 `timestamp` 值,`csrf` 为 cookie 中的 `bili_jct` 值也可为空 +4. 发送 `POST` 请求,获取 `data` 字段中的 `ticket` 字段的值即为所求 + +## Demo + +### Python + +需要 `requests` 依赖 ```python import hmac @@ -59,4 +73,106 @@ if __name__ == '__main__': 'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0" } resp = requests.post(url, params=params,headers=headers).json() -``` \ No newline at end of file + print(resp) +``` + +### Java + +无需第三方依赖 + +```java +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.nio.charset.StandardCharsets; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; + +public class BiliTicketDemo { + + /** + * Convert a byte array to a hex string. + * + * @param bytes The byte array to convert. + * @return The hex string representation of the given byte array. + */ + public static String bytesToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + sb.append('0'); + } + sb.append(hex); + } + return sb.toString(); + } + + /** + * Generate a HMAC-SHA256 hash of the given message string using the given key + * string. + * + * @param key The key string to use for the HMAC-SHA256 hash. + * @param message The message string to hash. + * @throws Exception If an error occurs during the HMAC-SHA256 hash generation. + * @return The HMAC-SHA256 hash of the given message string using the given key + * string. + */ + public static String hmacSha256(String key, String message) throws Exception { + Mac mac = Mac.getInstance("HmacSHA256"); + SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + mac.init(secretKeySpec); + byte[] hash = mac.doFinal(message.getBytes(StandardCharsets.UTF_8)); + return bytesToHex(hash); + } + + /** + * Get a Bilibili web ticket for the given CSRF token. + * + * @param csrf The CSRF token to use for the web ticket, can be {@code null} or + * empty. + * @return The Bilibili web ticket raw response for the given CSRF token. + * @throws Exception If an error occurs during the web ticket generation. + * @see https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/misc/sign/bili_ticket.md + */ + public static String getBiliTicket(String csrf) throws Exception { + // params + long ts = System.currentTimeMillis() / 1000; + String hexSign = hmacSha256("XgwSnGZ1p", "ts" + ts); + StringBuilder url = new StringBuilder( + "https://api.bilibili.com/bapis/bilibili.api.ticket.v1.Ticket/GenWebTicket"); + url.append('?'); + url.append("key_id=ec02").append('&'); + url.append("hexsign=").append(hexSign).append('&'); + url.append("context[ts]=").append(ts).append('&'); + url.append("csrf=").append(csrf == null ? "" : csrf); + // request + HttpURLConnection conn = (HttpURLConnection) new URI(url.toString()).toURL().openConnection(); + conn.setRequestMethod("POST"); + conn.addRequestProperty("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0"); + InputStream in = conn.getInputStream(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) != -1) { + out.write(b); + } + return new String(out.toByteArray(), StandardCharsets.UTF_8); + } + + /** + * Main method to test the BiliTicketDemo class. + * + * @param args The command line arguments (not used). + */ + public static void main(String[] args) { + try { + System.out.println(getBiliTicket("")); // use empty CSRF here + } catch (Exception e) { + e.printStackTrace(); + } + } + +} +``` diff --git a/docs/misc/sign/wbi.md b/docs/misc/sign/wbi.md index be86781..358bc5f 100644 --- a/docs/misc/sign/wbi.md +++ b/docs/misc/sign/wbi.md @@ -700,8 +700,6 @@ public class WbiTest { map.put("bar", "五一四"); map.put("baz", 1919810); map.put("wts", System.currentTimeMillis() / 1000); - map.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"); - map.put("Referer", "https://www.bilibili.com/"); StringJoiner param = new StringJoiner("&"); //排序 + 拼接字符串 map.entrySet().stream() diff --git a/docs/misc/time_stamp.md b/docs/misc/time_stamp.md index d4e6459..6914205 100644 --- a/docs/misc/time_stamp.md +++ b/docs/misc/time_stamp.md @@ -2,7 +2,7 @@ ## 获取当前时间戳 -> https://api.bilibili.com/x/report/click/now +> https://api.bilibili.com/x/report/click/now > https://api.bilibili.com/x/click-interface/click/now *请求方式:GET* diff --git a/docs/user/space.md b/docs/user/space.md index b5dec5d..61f310d 100644 --- a/docs/user/space.md +++ b/docs/user/space.md @@ -1008,6 +1008,325 @@ curl -G 'http://space.bilibili.com/ajax/settings/getSettings' \ +#### 查询可用头图列表 (Web端) + +> https://space.bilibili.com/ajax/topphoto/getlist + +*请求方式: GET* + +注: 带有转义 + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | ----------- | ------ | -------------------------- | +| mid | num | 目标用户mid | 必要 | 非负数, 即使该用户并不存在 | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------ | ------------------------- | -------------------------------------- | ---- | +| status | bool | 成功: true
失败: false | | +| data | 成功: array
失败: str | 成功: 信息本体
失败: "用户id错误" | | + +`data`数组中的对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------------- | ---- | ----------- | ------------------------------------ | +| id | num | 空间头图 ID | | +| product_name | str | 显示名称 | | +| price | num | 价格 | | +| coin_type | num | 支付类型? | | +| vip_free | num | 大会员免费 | | +| s_img | str | 小图 URI | 需要自行与 `i0.hdslb.com` 拼接成 URL | +| l_img | str | 大图 URI | 同 s_img | +| thumbnail_img | str | 空 | 并不存在的缩略图? | +| sort_num | num | 排序编号 | | +| is_disable | num | 已禁用 | 0: 未禁用 | +| expire | num | 过期时间? | UNIX 时间戳, 或 0 为永不过期 | +| had | num | 是否拥有? | 当 expire 不为 0 时 为 1, 否则为 0 | + +**示例:** + +查询`mid=1145141919810000000`的可用空间头图 + +```shell +curl -G "https://space.bilibili.com/ajax/topphoto/getlist" \ +--data-urlencode "mid=1145141919810000000" +``` + +
+查看响应示例: + +```json +{ + "status": true, + "data": [ + { + "id": 1, + "product_name": "bilibili春", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png", + "l_img": "bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png", + "thumbnail_img": "", + "sort_num": 19, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 2, + "product_name": "两人单车", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/d60a4be11f1bca6168a60a53c64bca18eddd6443.jpg", + "l_img": "bfs/space/44873d3568bdcb3d850d234e02a19602972450f1.png", + "thumbnail_img": "", + "sort_num": 16, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 5, + "product_name": "成为偶像", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/5fe2632486a5a91a234f0e7cb368ab6397477da4.jpg", + "l_img": "bfs/space/87277d30cd19edcec9db466a9a3e556aeb0bc0ed.png", + "thumbnail_img": "", + "sort_num": 15, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 11, + "product_name": "星际勘探", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/6849abc6e67000ad807b35a970aba31dd1e400dd.jpg", + "l_img": "bfs/space/c919a9818172a8297f8b0597722f96504a1e1d88.png", + "thumbnail_img": "", + "sort_num": 14, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 10, + "product_name": "星O大战", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/ff3b0882e55c1099738e59616e5956ad357d9948.jpg", + "l_img": "bfs/space/e22f5b8e06ea3ee4de9e4da702ce8ef9a2958f5a.png", + "thumbnail_img": "", + "sort_num": 13, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 12, + "product_name": "王牌特工", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/f5d38e2af44fd12fa65423aff55933fcf9071419.jpg", + "l_img": "bfs/space/8cd85a382756ab938df23a856017abccd187188e.png", + "thumbnail_img": "", + "sort_num": 12, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 3, + "product_name": "仰望星空", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/c9dae917e24b4fc17c4d544caf6b6c0b17f8692b.jpg", + "l_img": "bfs/space/9ccc0447aebf0656809b339b41aa5b3705f27c47.png", + "thumbnail_img": "", + "sort_num": 11, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 14, + "product_name": "雨过天晴", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/1115b2fdabd128337f892feada4ce32e51f3a5ad.jpg", + "l_img": "bfs/space/6a1198e25f8764bd30d53411dac9fdf840bc3265.png", + "thumbnail_img": "", + "sort_num": 10, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 6, + "product_name": "绿荫秘境", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/dc02d22a718c1c436f1a355b3cd726b04098ef7d.jpg", + "l_img": "bfs/space/265ecddc52d74e624dc38cf0cff13317085aedf7.png", + "thumbnail_img": "", + "sort_num": 9, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 13, + "product_name": "漫游仙境", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/184abe52a5ea9390b506c064cfba4f8f20ae9cca.jpg", + "l_img": "bfs/space/24d0815514951bb108fbb360b04a969441079315.png", + "thumbnail_img": "", + "sort_num": 7, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 15, + "product_name": "放课后time", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/aea2dd7b8894ce31d578d4fad6a7188c7b49cb2f.jpg", + "l_img": "bfs/space/6e799ff2de2de55d27796707a283068d66cdf3f4.png", + "thumbnail_img": "", + "sort_num": 6, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 4, + "product_name": "昴宿星团", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/1f4eaf70d1bb981f6057b3e440249d7a1f65774f.jpg", + "l_img": "bfs/space/3ab888c1d149e864ab44802dea8c1443e940fa0d.png", + "thumbnail_img": "", + "sort_num": 5, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 7, + "product_name": "蔷薇洛丽塔", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/718eac8c71e29b8a80431c46110805c3a40e30a6.jpg", + "l_img": "bfs/space/70ce28bcbcb4b7d0b4f644b6f082d63a702653c1.png", + "thumbnail_img": "", + "sort_num": 4, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 9, + "product_name": "黑暗之门", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/ef1b08e62fdc35b06e39795bc6de8e510935bf97.jpg", + "l_img": "bfs/space/cd52d4ac1d336c940cc4958120170f7928d9e606.png", + "thumbnail_img": "", + "sort_num": 3, + "is_disable": 0, + "expire": 0, + "had": 0 + }, + { + "id": 19, + "product_name": "你的名字", + "price": 0, + "coin_type": 0, + "vip_free": 0, + "s_img": "bfs/space/373e127e8784d3e4c1b5e6db0c27702ba077643f.jpg", + "l_img": "bfs/space/f49642b3683a08e3190f29d5a095386451f8952c.jpg", + "thumbnail_img": "", + "sort_num": 2, + "is_disable": 0, + "expire": 0, + "had": 0 + } + ] +} +``` + +
+ +### 设置空间头图 (Web端) + +> https://space.bilibili.com/ajax/settings/setToutu + +*请求方式: POST* + +认证方式: Cookie (SESSDATA) + +鉴权方式: referer为 `.bilibili.com` 域名下 + +**正文参数(application/x-www-form-urlencoded):** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | ---------------------------------- | ------ | ---- | +| id | num | 头图 ID | 必要 | | +| csrf | str | CSRF Token (即 Cookie bili_jct 值) | 不必要 | | + +**JSON回复:** + +| 字段 | 类型 | 内容 | 备注 | +| ------ | ---- | -------- | --------------------------- | +| status | bool | 状态 | true: 成功
false: 失败 | +| data | str | 错误信息 | 正确时无此项 (带有转义) | + +**示例:** + +设置空间头图为为`王牌特工(id=12)` + +```shell +curl -X POST "https://space.bilibili.com/ajax/settings/setToutu" \ +--referer "https://space.bilibili.com/" \ +--data-urlencode "id=12" \ +--data-urlencode "csrf=xxx" \ +-b "SESSDATA=xxx; bili_jct=xxx" +``` + +
+查看响应示例: + +```json +{ + "status": true +} +``` + +
+ #### 调整空间板块布局 > http://space.bilibili.com/ajax/settings/setIndexOrder @@ -1034,7 +1353,7 @@ curl -G 'http://space.bilibili.com/ajax/settings/getSettings' \ | 3 | (左侧)订阅番剧 | | 4 | (左侧)订阅标签 | | 5 | (左侧)最近投币的视频 | -| 6 | (左侧)我的圈子**(此板块被隐藏)** | +| 6 | (左侧)我的圈子 **(此板块被隐藏)** | | 7 | (左侧)我的频道 | | 8 | (左侧)我的专栏 | | 9 | (左侧)我的相簿 | @@ -1050,24 +1369,26 @@ curl -G 'http://space.bilibili.com/ajax/settings/getSettings' \ | 字段 | 类型 | 内容 | 备注 | | ------ | ---- | -------- | ----------------------------------- | -| ststus | bool | 操作结果 | true:操作成功
false:操作失败 | +| status | bool | 操作结果 | true:操作成功
false:操作失败 | | data | str | 错误信息 | 正确时无此项 | **示例:** 调整空间布局为: ->我的稿件 直播间 ->我的专栏 个人资料 ->订阅番剧 公告 ->我的收藏夹 官方活动 ->我的相簿 最近玩的游戏 ->最近投币的视频 ->订阅标签 ->我的频道 +```text +我的稿件 直播间 +我的专栏 个人资料 +订阅番剧 公告 +我的收藏夹 官方活动 +我的相簿 最近玩的游戏 +最近投币的视频 +订阅标签 +我的频道 +``` ```shell -curl 'http://space.bilibili.com/ajax/settings/setIndexOrder' \ +curl 'https://space.bilibili.com/ajax/settings/setIndexOrder' \ --data-urlencode 'index_order=1,8,3,2,9,5,4,7,22,23,21,24,25,6' \ --data-urlencode 'csrf=xxx' \ -b 'SESSDATA=xxx;DedeUserID=1;DedeUserID__ckMd5=1;' \ @@ -1113,7 +1434,7 @@ curl 'http://space.bilibili.com/ajax/settings/setIndexOrder' \ | 字段 | 类型 | 内容 | 备注 | | ------ | ---- | -------- | ----------------------------------- | -| ststus | bool | 操作结果 | true:操作成功
false:操作失败 | +| status | bool | 操作结果 | true:操作成功
false:操作失败 | | data | str | 错误信息 | 正确时无此项 | **示例:** @@ -1121,7 +1442,7 @@ curl 'http://space.bilibili.com/ajax/settings/setIndexOrder' \ 设置`关注的TAG`为隐藏 ```shell -curl 'http://space.bilibili.com/ajax/settings/setPrivacy' \ +curl 'https://space.bilibili.com/ajax/settings/setPrivacy' \ --data-urlencode 'tags=0' \ --data-urlencode 'csrf=xxx' \ -b 'SESSDATA=xxx;DedeUserID=1;DedeUserID__ckMd5=1;' \ @@ -4298,7 +4619,7 @@ curl -G 'https://api.bilibili.com/x/space/bangumi/follow/list' \ | 字段 | 类型 | 内容 | 备注 | | ------ | ---------------------------- | -------------------------------------- | --------------------------- | -| ststus | bool | 返回值 | false:错误
true:正确 | +| status | bool | 返回值 | false:错误
true:正确 | | data | 错误时:str
正确时:obj | 错误时:错误信息
正确时:数据本体 | 正确时不返回错误信息 | `data`对象: diff --git a/docs/video/action.md b/docs/video/action.md index b841b95..56a3f3c 100644 --- a/docs/video/action.md +++ b/docs/video/action.md @@ -460,7 +460,7 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/coins' \ > https://api.bilibili.com/medialist/gateway/coll/resource/deal > -> https://api.bilibili.com/x/v3/fav/resource/deal +> https://api.bilibili.com/x/v3/fav/resource/deal *请求方式:POST* @@ -485,7 +485,7 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/coins' \ | 字段 | 类型 | 内容 | 备注 | | ------- | ---- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| code | num | 返回值 | 0:成功
-101:账号未登录
-111:csrf校验失败
-400:请求错误
-403:访问权限不足
10003:不存在该稿件
11201:已经收藏过了
11202:已经取消收藏了
11203:达到收藏上限
72010017:参数错误 | +| code | num | 返回值 | 0:成功
-101:账号未登录
-111:csrf校验失败
-400:请求错误
-403:访问权限不足
10003:不存在该稿件
11010: 您访问的内容不存在
11201:已经收藏过了
11202:已经取消收藏了
11203:达到收藏上限
72010017:参数错误 | | message | str | 错误信息 | 正确为success | | data | obj | 信息本体 | | diff --git a/docs/video_ranking/dynamic.md b/docs/video_ranking/dynamic.md index b06cea2..225ce35 100644 --- a/docs/video_ranking/dynamic.md +++ b/docs/video_ranking/dynamic.md @@ -1,9 +1,5 @@ # 分区最新视频 -- [获取分区最新视频列表](#获取分区最新视频列表) - ---- - ## 获取分区最新视频列表 > https://api.bilibili.com/x/web-interface/dynamic/region @@ -15,7 +11,7 @@ | 参数名 | 类型 | 内容 | 必要性 | 备注 | | ------ | ---- | ----------- | ------ | ------- | | pn | num | 页码 | 非必要 | 默认为1 | -| ps | num | 每页项数 | 非必要 | 默认为5 | +| ps | num | 每页项数 | 非必要 | 默认为14, 留空为5 | | rid | num | 目标分区tid | 必要 | | **json回复:** @@ -197,3 +193,445 @@ curl -G 'https://api.bilibili.com/x/web-interface/dynamic/region' \ ``` + +### 获取分区标签近期互动列表 + +> https://api.bilibili.com/x/web-interface/dynamic/tag + +*请求方式: GET* + +**url参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | ---------- | ------ | ----------------- | +| ps | num | 视频数 | 非必要 | 默认为14, 留空为5 | +| pn | num | 列数 | 非必要 | 留空为1 | +| rid | num | 目标分区id | 必要 | 参见[视频分区一览](../video/video_zone.md) | +| tag_id | num | 目标标签id | 必要 | | + +**json回复:** + +与[获取分区最新视频列表](#获取分区最新视频列表)相同, 略 + +**示例:** + +获取`tid=136(游戏->音游)`分区中`tag_id=10026108(Phigros)`标签近期互动列表的2条视频信息 + +```shell +curl -G 'https://api.bilibili.com/x/web-interface/dynamic/tag' \ +--data-urlencode 'rid=136' \ +--data-urlencode 'tag_id=10026108' \ +--data-urlencode 'ps=2' \ +--data-urlencode 'pn=1' +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "page": { + "num": 1, + "size": 2, + "count": 152 + }, + "archives": [ + { + "aid": 1452657587, + "videos": 1, + "tid": 136, + "tname": "音游", + "copyright": 1, + "pic": "http://i1.hdslb.com/bfs/archive/4cb13f97e0d4b43645728432468e44b40ad343de.jpg", + "title": "【MuseDash x Phigros/逆天愚人节谱面】Retribution ~Cycle of Redemption~ Lv.? AP", + "pubdate": 1712310000, + "ctime": 1712302810, + "desc": "谱师:Mayflycmd(@命令提示符 )", + "state": 0, + "duration": 189, + "rights": { + "bp": 0, + "elec": 0, + "download": 0, + "movie": 0, + "pay": 0, + "hd5": 0, + "no_reprint": 1, + "autoplay": 1, + "ugc_pay": 0, + "is_cooperation": 0, + "ugc_pay_preview": 0, + "no_background": 0, + "arc_pay": 0, + "pay_free_watch": 0 + }, + "owner": { + "mid": 3493136175204754, + "name": "TempoTiger", + "face": "https://i1.hdslb.com/bfs/face/0cf2722f9aaa0db94f9166a8084e347bca3580f4.jpg" + }, + "stat": { + "aid": 1452657587, + "view": 27021, + "danmaku": 141, + "reply": 113, + "favorite": 306, + "coin": 144, + "share": 95, + "now_rank": 0, + "his_rank": 0, + "like": 1050, + "dislike": 0, + "vt": 0, + "vv": 27021 + }, + "dynamic": "", + "cid": 1494650111, + "dimension": { + "width": 1920, + "height": 1080, + "rotate": 0 + }, + "short_link_v2": "https://b23.tv/BV1Eq421w7T4", + "first_frame": "http://i0.hdslb.com/bfs/storyff/n240405sa2zsrp9x2i3erx1ln8icirs6_firsti.jpg", + "pub_location": "广东", + "cover43": "", + "bvid": "BV1Eq421w7T4", + "season_type": 0, + "is_ogv": false, + "ogv_info": null, + "rcmd_reason": "", + "enable_vt": 0, + "ai_rcmd": null + }, + { + "aid": 1155789590, + "videos": 1, + "tid": 136, + "tname": "音游", + "copyright": 1, + "pic": "http://i1.hdslb.com/bfs/archive/c75674c8d104421d1794e69926d42ffa90e7d73d.jpg", + "title": "[Phigros 自制谱] 把一切都倾注进去吧!/ 雑踏、僕らの街 - TOGENASHI TOGEARI", + "pubdate": 1719687153, + "ctime": 1719687153, + "desc": "不是,你们怎么忍住把这键盘歌写这么简单的?\n不是,你们怎么忍住把这键盘歌写这么简单的?\n不是,你们怎么忍住把这键盘歌写这么简单的?\n\n应该是 Phigros 第一个写满三分钟的,虽然后面抄了很多重复配置,但无伤大雅(\n个人定数 16.6,其实就两段 5k 键盘难,看时间长多给了 0.1\n所以啊\n\n愤怒也好喜悦也好悲伤也好,把一切都倾注进去!\n怒りも喜びも哀しさも、全部ぶちこめ。\n\n-- 6.30 更新,修了一个特效的问题,改了一个很蹭的配置和一个很丑的排键", + "state": 0, + "duration": 201, + "mission_id": 1726375, + "rights": { + "bp": 0, + "elec": 0, + "download": 0, + "movie": 0, + "pay": 0, + "hd5": 0, + "no_reprint": 1, + "autoplay": 1, + "ugc_pay": 0, + "is_cooperation": 0, + "ugc_pay_preview": 0, + "no_background": 0, + "arc_pay": 0, + "pay_free_watch": 0 + }, + "owner": { + "mid": 341532844, + "name": "西宮缄", + "face": "https://i1.hdslb.com/bfs/face/1387108d9337c04c27ce2d8d75679e40540d4c14.jpg" + }, + "stat": { + "aid": 1155789590, + "view": 39479, + "danmaku": 303, + "reply": 169, + "favorite": 1650, + "coin": 473, + "share": 653, + "now_rank": 0, + "his_rank": 0, + "like": 5843, + "dislike": 0, + "vt": 0, + "vv": 39479 + }, + "dynamic": "打这个比溜冰还爽", + "cid": 1600971084, + "dimension": { + "width": 2000, + "height": 1500, + "rotate": 0 + }, + "season_id": 3395535, + "short_link_v2": "https://b23.tv/BV1iZ421g7E8", + "first_frame": "http://i1.hdslb.com/bfs/storyff/n240630sa3chl8idnpz8d31t6yaczagn_firsti.jpg", + "pub_location": "天津", + "cover43": "", + "bvid": "BV1iZ421g7E8", + "season_type": 0, + "is_ogv": false, + "ogv_info": null, + "rcmd_reason": "", + "enable_vt": 0, + "ai_rcmd": null + } + ] + } +} +``` + +
+ +### 获取分区近期投稿列表 + +> https://api.bilibili.com/x/web-interface/newlist + +*请求方式: GET* + +注: 该接口在 Web 端实际情况中被请求, 但似乎未在页面中显示, 作用尚不清楚 + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | ---------- | ------ | ----------------- | +| ps | num | 视频数 | 非必要 | 默认为14, 留空为5 | +| pn | num | 页码 | 非必要 | 默认为1 | +| rid | num | 目标分区id | 非必要 | 参见[视频分区一览](../video/video_zone.md) | +| type | num | 类型? | 非必要 | 默认为0 | + +**JSON回复:** + +与[获取分区最新视频列表](#获取分区最新视频列表)相同, 略 + +**示例:** + +与[获取分区最新视频列表](#获取分区最新视频列表)相似, 略 + +### 获取分区近期投稿列表 (带排序) + +> https://api.bilibili.com/x/web-interface/newlist_rank + +*请求方式: GET* + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ----------- | ---- | --------- | ------ | ------- | +| main_ver | str | 主页版本 | 非必要 | 默认为 `v3` | +| search_type | str | 搜索类型 | 必要 | 默认为 `video` | +| view_type | str | 查看类型? | 必要 | 默认为 `hot_rank` | +| copy_right | num | 版权? | 非必要 | 默认为 `-1` | +| new_web_tag | num | 标签? | 非必要 | 默认为 `1` | +| order | str | 排序方式 | 非必要 | click: 按播放排序(默认)
scores: 按评论数排序
stow: 按收藏排序
coin: 按硬币数排序
dm: 按弹幕数排序| +| cate_id | num | 分区id | 必要 | 留空会导致响应中`data`中`result`为`null`, 参见[视频分区一览](../video/video_zone.md) | +| page | num | 页码 | 非必要 | 默认以 `1` 开始 | +| pagesize | num | 视频数 | 必要 | 默认为 `30`, 留空会导致 -500 | +| time_from | num | 起始时间 | 必要 | yyyyMMdd, 默认为 `time_to` - 7 | +| time_to | num | 结束时间 | 必要 | yyyyMMdd, 默认为当前时间(大于起始时间) | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ----- | +| code | num | 返回值 | 0:成功
-500: 未传pagesize
-10: 未传其余必要参数 | +| message | str | 错误信息 | 无为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | 错误为null | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---------------- | ----- | ------------------ | ----- | +| exp_list | null | | 作用尚不明确 | +| show_module_list | array | 显示模块列表? | | +| result | array | 结果本体 | 失败时为null | +| show_column | num | 0 | 作用尚不明确 | +| rqt_type | str | search | 作用尚不明确 | +| numPages | num | 页码 | 失败时为0 | +| numResults | num | 视频数 | 失败时为0 | +| crr_query | str | 空 | 作用尚不明确 | +| pagesize | num | 视频数 | | +| suggest_keyword | num | 空 | 作用尚不明确 | +| egg_info | null | | 作用尚不明确 | +| cache | num | 0 | 作用尚不明确 | +| exp_bits | num | 1 | 作用尚不明确 | +| exp_str | str | 空 | 作用尚不明确 | +| seid | str | 一串字符串中的数字 | 作用尚不明确 | +| msg | str | 结果信息 | 成功时为`success`, 反之为`as error.` | +| egg_hit | num | 0 | 作用尚不明确 | +| page | num | 页码 | | + +`data`中的`show_module_list`数组: + +| 项 | 类型 | 内容 | 备注 | +| ---- | ---- | ------------- | ---- | +| 0 | str | tips | | +| 1 | str | brand_ad | | +| 2 | str | esports | | +| 3 | str | activity | | +| 4 | str | web_game | | +| 5 | str | card | | +| 6 | str | media_bangumi | | +| 7 | str | media_ft | | +| 8 | str | bili_user | | +| 9 | str | user | | +| 10 | str | star | | +| 11 | str | video | | + +`data`中的`result`数组中的对象: + +| 字段 | 类型 | 内容 | 备注 | +| -------------- | ---- | -------------- | ----- | +| pubdate | str | 发布时间 | 格式为 `yyyy-MM-dd HH:mm:ss` | +| pic | str | 封面图 | | +| tag | str | 标签 | 用 `,` 分隔 | +| duration | num | 时长 | 单位为秒 | +| id | num | aid | | +| rank_score | num | 排序分数? | | +| badgepay | bool | 是否有角标? | | +| senddate | num | 发送时间? | UNIX 秒级时间戳 | +| author | str | UP主名 | | +| review | num | 评论数 | | +| mid | num | UP主mid | | +| is_union_video | num | 是否为联合投稿 | | +| rank_index | num | 排序索引号 | | +| type | str | 类型 | video: 视频 | +| arcrank | str | 0 | 作用尚不明确 | +| play | str | 播放数 | | +| rank_offset | num | 排序偏移? | 与 `rank_index` 相同 | +| description | str | 简介 | | +| video_review | num | 弹幕数? | | +| is_pay | num | 是否付费? | 0: 免费
1: 付费 | +| favorites | num | 收藏数 | | +| arcurl | str | 视频播放页URL | | +| bvid | str | bvid | | +| title | str | 标题 | | +| vt | num | 0 | 作用尚不明确 | +| enable_vt | num | 0 | 作用尚不明确 | +| vt_display | str | 空 | 作用尚不明确 | + +**示例:** + +获取`tid=231(科技->计算机技术)`分区近期投稿列表, 按播放数排序, 页码为1, 视频数为2, 时间一周 + +```shell +curl -G 'https://api.bilibili.com/x/web-interface/newlist_rank' \ +--data-urlencode 'search_type=video' \ +--data-urlencode 'view_type=hot_rank' \ +--data-urlencode 'order=click' \ +--data-urlencode 'cate_id=231' \ +--data-urlencode 'page=1' \ +--data-urlencode 'pagesize=2' \ +--data-urlencode 'time_from=20240716' \ +--data-urlencode 'time_to=20240723' +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "exp_list": null, + "show_module_list": [ + "tips", + "brand_ad", + "esports", + "activity", + "web_game", + "card", + "media_bangumi", + "media_ft", + "bili_user", + "user", + "star", + "video" + ], + "result": [ + { + "pubdate": "2024-07-19 15:27:23", + "pic": "//i0.hdslb.com/bfs/archive/a6c2a8669e623333eee4bd8316b4e7b01716b7f2.jpg", + "tag": "微软,Microsoft", + "duration": 14, + "id": 1406270001, + "rank_score": 237205, + "badgepay": false, + "senddate": 1721410429, + "author": "柚子木字幕组", + "review": 928, + "mid": 221648, + "is_union_video": 0, + "rank_index": 1, + "type": "video", + "arcrank": "0", + "play": "237205", + "rank_offset": 1, + "description": "X", + "video_review": 42, + "is_pay": 0, + "favorites": 618, + "arcurl": "http://www.bilibili.com/video/av1406270001", + "bvid": "BV1gr421M7rE", + "title": "突发:微软服务中断正在影响全球用户", + "vt": 0, + "enable_vt": 0, + "vt_display": "" + }, + { + "pubdate": "2024-07-17 22:12:47", + "pic": "//i0.hdslb.com/bfs/archive/1b02bc3806369f8c051a84e1ffef11b22695e659.jpg", + "tag": "演讲,大学,编程,英伟达,人工智能,TED,AI,黄仁勋", + "duration": 1908, + "id": 1556206286, + "rank_score": 52653, + "badgepay": false, + "senddate": 1721225567, + "author": "YouTube精选字幕组", + "review": 147, + "mid": 487511093, + "is_union_video": 0, + "rank_index": 2, + "type": "video", + "arcrank": "0", + "play": "52648", + "rank_offset": 2, + "description": "New SciTech\n上月加州理工学院毕业典礼上,刚刚带领英伟达达成世界第一市值的CEO黄仁勋,到场分享对当下AI革命趋势的见解、带领英伟达转型成AI公司的历程、以及自己在职场这么多年的人生感悟。\n\n全程没有上位者那种空洞无意义的说教,都是真实的发展故事和对未来世界的看法。如果你的工作生活中有涉及到AI技术的可能,那么这期演讲将会非常有意义。", + "video_review": 16, + "is_pay": 0, + "favorites": 2152, + "arcurl": "http://www.bilibili.com/video/av1556206286", + "bvid": "BV1C1421b7dD", + "title": "“这个时代要跑,不要走”黄仁勋加州理工毕业演讲完整版", + "vt": 0, + "enable_vt": 0, + "vt_display": "" + } + ], + "show_column": 0, + "rqt_type": "search", + "numPages": 404, + "numResults": 808, + "crr_query": "", + "pagesize": 2, + "suggest_keyword": "", + "egg_info": null, + "cache": 0, + "exp_bits": 1, + "exp_str": "", + "seid": "6717218533109517809", + "msg": "success", + "egg_hit": 0, + "page": 1 + } +} +``` + +
From eba3aae1018d8796d6f0cf3de9df24535b00ac50 Mon Sep 17 00:00:00 2001 From: Scott Sloan Date: Fri, 26 Jul 2024 10:26:12 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=85=E6=99=B0=E5=BA=A6=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=A1=A8=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/bangumi/videostream_url.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/bangumi/videostream_url.md b/docs/bangumi/videostream_url.md index 90f0b7c..e8a53da 100644 --- a/docs/bangumi/videostream_url.md +++ b/docs/bangumi/videostream_url.md @@ -16,6 +16,7 @@ B站的番剧视频为http流媒体,需要对应的api以视频id获取取流u | 64 | 720P 高清 | web端默认值
B站前端需要登录才能选择,但是直接发送请求可以不登录就拿到720P的取流地址
**无720P时则为720P60** | | 74 | 720P60 高帧率 | 需要认证登录账号 | | 80 | 1080P 高清 | TV端与APP端默认值
需要认证登录账号 | +| 100 | 智能修复 | 仅支持dash方式
需要`fnval&12240=12240`
需要认证登录账号 | | 112 | 1080P+ 高码率 | 大多情况需求认证大会员账号 | | 116 | 1080P60 高帧率 | 大多情况需求认证大会员账号 | | 120 | 4K 超清 | 需要`fnval&128=128`且`fourk=1`
大多情况需求认证大会员账号 | @@ -44,6 +45,7 @@ B站的番剧视频为http流媒体,需要对应的api以视频id获取取流u | 512 | 是否需求杜比视界 | 必须为dash格式
大多情况需求认证大会员账号 | | 1024 | 是否需求 8K 分辨率 | 必须为dash格式
需要`qn=127`
大多情况需求认证大会员账号 | | 2048 | 是否需求 av1 编码 | 必须为dash格式 | +| 12240 | 是否需求智能修复 | 必须为dash格式
需要认证大会员账号 | 例如:请求dash格式且需要HDR的视频流,则`fnval=16|64=80` From 2465990ccc5aea35ad6d0b17dc7c2f36bc5e45c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Session=E5=B0=8F=E8=83=A1?= <102411014+SessionHu@users.noreply.github.com> Date: Sat, 27 Jul 2024 13:49:12 +0800 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0web=E7=AB=AF?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=93=8D=E4=BD=9C=E6=92=AD=E6=94=BE=E5=90=88?= =?UTF-8?q?=E9=9B=86=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20(#1064)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [d1a4f6d](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/d1a4f6dd2b4e5d57188d56671b1dfacc299ea3fd) close #1062 ~by myself~ - [ff450a6](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/ff450a65693dbdc3c9a78a05c67ddbc1a783a532) add Wbi API - [b3c3fce](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/b3c3fce1646e72985e46492224554ba8b505849a) close #707 - [fa6c9c8](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/fa6c9c8f575a617f6603935b5a77c9624dd5b9fb) new method of `buvid3` & `b_nut` from #790 - [45755b0](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/45755b01d8d9593d50658de83322dd79e7b45e21#diff-1a8d1ba142e61d01fd3b24620847ca2f2ff93f880973ea1e1d71de79d0123096R133) close #380 - [45755b0](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/45755b01d8d9593d50658de83322dd79e7b45e21#diff-1a8d1ba142e61d01fd3b24620847ca2f2ff93f880973ea1e1d71de79d0123096R542) add details in #244 - [1c5b778](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/1c5b7788f717f92a0e3f655e947db49e842f80e0) - [85e8fc5](https://github.com/SocialSisterYi/bilibili-API-collect/pull/1064/commits/85e8fc5304d94ccb7480545e38201219b71370ad) close #945 --- README.md | 2 +- docs/live/follow_up_live.md | 2 +- docs/misc/buvid3_4.md | 39 +- docs/user/info.md | 2 +- docs/video/action.md | 86 +- docs/video/collection.md | 1491 ++++++++++++++++++++++++++++++++++- docs/video/info.md | 1 + docs/video/report.md | 66 +- 8 files changed, 1651 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 3ffdecf..2364b21 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接 - [x] [图片格式化](docs/misc/picture.md) - [x] [bvid 说明](docs/misc/bvid_desc.md) - [ ] [设备唯一标识BUVID](docs/misc/device_identity.md) -- [ ] [获取 buvid3 / buvid4](docs/misc/buvid3_4.md) +- [ ] [获取 buvid3 / buvid4 / b_nut](docs/misc/buvid3_4.md) - [ ] [gRPC API 接口定义](grpc_api) - [ ] [登录](docs/login) - [x] [登录操作 (人机认证)](docs/login/login_action) diff --git a/docs/live/follow_up_live.md b/docs/live/follow_up_live.md index ed91573..5e88da5 100644 --- a/docs/live/follow_up_live.md +++ b/docs/live/follow_up_live.md @@ -2,7 +2,7 @@ ## 用户关注的所有UP的直播情况 -> https://api.bilibili.com/x/space/wbi/acc/info +> https://api.live.bilibili.com/xlive/web-ucenter/user/following *请求方式:GET* diff --git a/docs/misc/buvid3_4.md b/docs/misc/buvid3_4.md index 13d386e..91441d0 100644 --- a/docs/misc/buvid3_4.md +++ b/docs/misc/buvid3_4.md @@ -1,4 +1,4 @@ -# 获取 buvid3 / buvid4 +# 获取 buvid3 / buvid4 / b_nut ## 游客获取 buvid3 / buvid4 @@ -46,3 +46,40 @@ curl -G 'https://api.bilibili.com/x/frontend/finger/spi' ``` + +## 从响应头获取 buvid3 / b_nut + +使用 `GET` 或 `HEAD` 方法请求 `https://www.bilibili.com/`, 且请求头中 `User-Agent` 字段不包含 `curl` `python` `awa` 等敏感子字符串, 且相同 `User-Agent` 字段不得短时多次请求. 在响应头中的 `Set-Cookie` 字段中, 即可找到 `buvid3` 和 `b_nut`. + +若不带任何 Cookie 请求, 则 `b_nut` 为响应生成时刻的 UNIX 秒级时间戳. +若请求 Cookie 仅带有 `buvid3`, 则 `b_nut` 为 `100`. +若请求 Cookie 仅带有 `b_nut`, 则与不带任何 Cookie 的响应相同. +若请求 Cookie 仅带有 `buvid3` 和 `b_nut`, 则响应无 `Set-Cookie` 字段. +若请求 Cookie 带有其他字段, 无影响. + +**示例:** + +```shell +curl -I "https://www.bilibili.com/" -A "awa" +``` + +
+查看响应示例: + +```http +HTTP/2 200 +date: Fri, 26 Jul 2024 06:38:43 GMT +content-type: text/html; charset=utf-8 +support: nantianmen +set-cookie: buvid3=805E4894-96A2-0684-6F00-C6EA1FFB911023315infoc; path=/; expires=Sat, 26 Jul 2025 06:38:43 GMT; domain=.bilibili.com +set-cookie: b_nut=1721975923; path=/; expires=Sat, 26 Jul 2025 06:38:43 GMT; domain=.bilibili.com +vary: Origin,Accept-Encoding +idc: shjd +expires: Fri, 26 Jul 2024 06:38:42 GMT +cache-control: no-cache +x-cache-webcdn: MISS from blzone01 +x-cache-time: 0 +x-save-date: Fri, 26 Jul 2024 06:38:43 GMT +``` + +
diff --git a/docs/user/info.md b/docs/user/info.md index 7f3f358..18f12b4 100644 --- a/docs/user/info.md +++ b/docs/user/info.md @@ -250,7 +250,7 @@ | title | str | 直播间标题 | | | cover | str | 直播间封面 url | | | watched_show | obj | | | -| roomid | num | 直播间 id(短号) | | +| roomid | num | 直播间 id | | | roundStatus | num | 轮播状态 | 0:未轮播
1:轮播 | | broadcast_type | num | 0 | | diff --git a/docs/video/action.md b/docs/video/action.md index 56a3f3c..8d22b7a 100644 --- a/docs/video/action.md +++ b/docs/video/action.md @@ -130,7 +130,7 @@ curl 'https://app.bilibili.com/x/v2/view/like' \ -### 判断视频是否被点赞(双端) +### 判断视频近期是否被点赞(双端) > https://api.bilibili.com/x/web-interface/archive/has/like @@ -138,6 +138,9 @@ curl 'https://app.bilibili.com/x/v2/view/like' \ 认证方式:APP或Cookie(SESSDATA) +注: 这一 API 实际上只能判断出视频**在近期内**是否被点赞, 并不能判断出视频是否被点赞. +「近期」的定义不明, 但至少半年前点赞过的视频, 用这一接口获取到的结果就已经是 `0` 了. 参见 [#380](https://github.com/SocialSisterYi/bilibili-API-collect/issues/380). + **url参数:** | 参数名 | 类型 | 内容 | 必要性 | 备注 | @@ -459,8 +462,6 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/coins' \ ### 收藏视频(双端) > https://api.bilibili.com/medialist/gateway/coll/resource/deal -> -> https://api.bilibili.com/x/v3/fav/resource/deal *请求方式:POST* @@ -475,8 +476,8 @@ curl -G 'https://api.bilibili.com/x/web-interface/archive/coins' \ | access_key | str | APP 登录 Token | APP 方式必要 | | | rid | num | 稿件 avid | 必要 | | | type | num | 必须为2 | 必要 | | -| add_media_ids | nums | 需要加入的收藏夹 mlid | 非必要 | 同时添加多个,用`,`(%2C)分隔 | -| del_media_ids | nums | 需要取消的收藏夹 mlid | 非必要 | 同时取消多个,用`,`(%2C)分隔 | +| add_media_ids | nums | 需要加入的收藏夹 mlid | 非必要(可选) | 同时添加多个,用`,`(%2C)分隔 | +| del_media_ids | nums | 需要取消的收藏夹 mlid | 非必要(可选) | 同时取消多个,用`,`(%2C)分隔 | | csrf | str | CSRF Token(位于 Cookie) | Cookie 方式必要 | | **json回复:** @@ -538,6 +539,81 @@ curl 'https://api.bilibili.com/medialist/gateway/coll/resource/deal' \ +### 收藏视频(Web端) + +> https://api.bilibili.com/x/v3/fav/resource/deal + +*请求方式: POST* + +认证方式: Cookie(SESSDATA) + +**正文参数(application/x-www-form-urlencoded):** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------------- | ---- | ---------------------------------- | ------------ | ------------------------------ | +| rid | num | 稿件 avid | 必要 | | +| type | num | 必须为2 | 必要 | | +| add_media_ids | nums | 需要加入的收藏夹 mlid | 非必要(可选) | 同时添加多个,用`,`(%2C)分隔 | +| del_media_ids | nums | 需要取消的收藏夹 mlid | 非必要(可选) | 同时取消多个,用`,`(%2C)分隔 | +| csrf | str | CSRF Token (即 Cookie 中 bili_jct) | 必要 | | +| platform | str | 平台标识? | 非必要 | web端: web | +| eab_x | num | 1 | 非必要 | 作用尚不明确 | +| ramval | num | 正整数 | 非必要 | 可能与在该页面的停留时间相关? | +| ga | num | 1 | 非必要 | 作用尚不明确 | +| gaia_source | str | ??? | 非必要 | web端: web_normal | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------- | +| code | num | 返回值 | 0: 成功
-101: 账号未登录
-111: csrf 校验失败
2001000: 参数错误 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | 错误时为 null 或不存在 | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ----------- | ---- | --------------------- | ----------------------- | +| prompt | bool | 是否为未关注用户收藏? | false:否
true:是 | +| ga_data | null | | 作用尚不明确 | +| toast_msg | str | 空 | 作用尚不明确 | +| success_num | num | 0 | 作用尚不明确 | + +**示例:** + +将视频 `av1906473802` 添加到收藏夹 `1164192068` 中 + +```shell +curl -sX POST "https://api.bilibili.com/x/v3/fav/resource/deal" \ +--data-urlencode "rid=1906473802" \ +--data-urlencode "type=2" \ +--data-urlencode "csrf=xxx" \ +--data-urlencode "add_media_ids=1164192068" \ +-b "SESSDATA=xxx; bili_jct=xxx" +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "prompt": false, + "ga_data": null, + "toast_msg": "", + "success_num": 0 + } +} +``` + +
+ ### 判断视频是否被收藏(双端) > https://api.bilibili.com/x/v2/fav/video/favoured diff --git a/docs/video/collection.md b/docs/video/collection.md index 410d753..44e03f0 100644 --- a/docs/video/collection.md +++ b/docs/video/collection.md @@ -1,8 +1,18 @@ -# 视频合集信息 +# 合集和视频列表信息 + +请注意区分 **合集(seasons_archives)** 和 **视频列表(seasons_series)** + +合集是后加入的功能, 图标为立体叠放的正方形(.icon-heji), 可以在创作中心管理 + +列表即系列(series)或频道(channel), 图标为平面叠放的矩形且中央有播放按钮标识(.icon-ic_channel1), 在个人空间直接操作 + +此处保留原 Issue 的表述, 参见 [#945](https://github.com/SocialSisterYi/bilibili-API-collect/issues/945) ## 获取视频合集信息 -> https://api.bilibili.com/x/polymer/web-space/seasons_archives_list +> https://api.bilibili.com/x/polymer/web-space/seasons_archives_list (需验证referer) +> +> https://api.bilibili.com/x/polymer/space/seasons_archives_list (旧接口, 不推荐使用, 无鉴权验证) *请求方式:GET* @@ -10,11 +20,15 @@ | 参数名 | 类型 | 内容 | 必要性 | 备注 | |--------|-----|------|--------|-----| -| mid | num | 用户 mid | 必要 | 似乎不一定需要创建者的 mid,随意的用户 mid 就能成功请求。 | +| mid | num | 用户 mid | 必要 | 创建者的 mid,但也可以是任意的非负整数 | | season_id | num | 视频合集 ID | 必要 | | -| sort_reverse | bool | 未知 | 可选 | | -| page_num | num | 页码索引 | 可选 | | -| page_size | num | 单页内容数量 | 可选 | | +| sort_reverse | bool | 排序方式 | 可选 | true: 升序排序
false: 默认排序 | +| page_num | num | 页码索引 | 可选 | 默认为 1 | +| page_size | num | 单页内容数量 | 可选 | 默认为 30 | +| gaia_vtoken | str | 风控验证? | 可选 | 若被风控则必要(如User-Agent不正常) | +| web_location | str | 页面位置? | 可选 | 333.999 | +| w_rid | str | WBI 签名 | 可选 | 参见 [WBI 签名](../misc/sign/wbi.md) | +| wts | num | UNIX 秒级时间戳 | 可选 | 参见 [WBI 签名](../misc/sign/wbi.md) | **json回复:** @@ -52,16 +66,16 @@ | bvid | str | 稿件 bvid || | ctime | num | 创建时间 | Unix 时间戳 | | duration | num | 视频时长 | 单位为秒 | -| enable_vt | bool | false || -| interactive_video | bool | false || +| enable_vt | bool | false | 旧接口无 | +| interactive_video | bool | 是否是互动视频 | | | pic | str | 封面 URL || -| playback_position | num || 会随着播放时间增长,播放完成后为 -1 。单位未知 | +| playback_position | num || 会随着播放时间增长,播放完成后为 -1 。单位为 % | | pubdate | num | 发布日期 | Unix 时间戳 | | stat | obj | 稿件信息 || | state | num | 0 || | title | str | 稿件标题|| -| ugc_pay | num | 0 || -| vt_display | str ||| +| ugc_pay | num | UGC 付费? | 0: 否 | +| vt_display | str | 空 | 旧接口无 | `archives`中的`stat`对象: @@ -90,3 +104,1458 @@ | page_num | num | 分页页码 | | | page_size | num | 单页个数 | | | total | num | 合集内视频数量 | | + +**示例:** + +获取 `mid=37737161` 的 `season_id=1227671` 视频合集信息,默认排序,第 1 页,每页 30 个视频 + +```shell +curl -G "https://api.bilibili.com/x/polymer/space/seasons_archives_list" \ +--data-urlencode "mid=37737161" \ +--data-urlencode "sort_reverse=false" \ +--data-urlencode "season_id=1227671" \ +--data-urlencode "page_num=1" \ +--data-urlencode "page_size=30" +``` + +
+查看响应示例: + + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "aids": [ + 311606079, + 400546145 + ], + "archives": [ + { + "aid": 311606079, + "bvid": "BV1XN411K7g9", + "ctime": 1679651747, + "duration": 261, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/234e6bd061176dba9e148f4373c52fa7cd2d801f.jpg", + "pubdate": 1679651747, + "stat": { + "view": 12145 + }, + "state": 0, + "title": "某些IT社区平台乱象,文章千篇一律,毫不注重版权,文章互相抄袭成潮流,希望能够好好管管!", + "ugc_pay": 0 + }, + { + "aid": 400546145, + "bvid": "BV1qo4y1L73P", + "ctime": 1682777426, + "duration": 335, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/a6b6fb0330bbf6c500720a024e5a9ade24d888c3.jpg", + "pubdate": 1682777425, + "stat": { + "view": 52743 + }, + "state": 0, + "title": "某些搜索引擎得到的结果,官方网站反而排在一些诈骗广告后面,诱导用户下载大量捆绑垃圾软件", + "ugc_pay": 0 + } + ], + "meta": { + "category": 0, + "cover": "https://archive.biliimg.com/bfs/archive/5e1c1f77c3065ec31eec43d7e35f7a061602e4d6.jpg", + "description": "白马首席讲师吐槽系列视频", + "mid": 37737161, + "name": "水浅王八多,真假白马说", + "ptime": 1682777425, + "season_id": 1227671, + "total": 2 + }, + "page": { + "page_num": 1, + "page_size": 30, + "total": 2 + } + } +} +``` + +
+ +## 只获取系列视频 + +> https://api.bilibili.com/x/polymer/web-space/home/seasons_series + +*请求方式: GET* + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| --------- | ---- | ------------ | ------ | ---- | +| mid | num | 用户 mid | 必要 | | +| page_num | num | 页码索引 | 必要 | | +| page_size | num | 单页内容数量 | 必要 | | +| gaia_vtoken | str | 风控验证? | 可选 | 若被风控则必要(如User-Agent不正常) | +| w_rid | str | WBI 签名 | 不必要 | 参见 [WBI 签名](../misc/sign/wbi.md) | +| wts | num | UNIX 秒级时间戳 | 不必要 | 参见 [WBI 签名](../misc/sign/wbi.md) | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------- | +| code | num | 返回值 | 0:成功
-352: 请求被风控
-400: 请求错误 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ----------- | ---- | -------- | -------- | +| items_lists | obj | 内容列表 | 套了个娃 | + +`data`中的`items_lists`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------------ | ----- | -------- | ---- | +| page | obj | 分页信息 | | +| seasons_list | array | 空 | | +| series_list | array | 系列列表 | | + +`items_lists`中的`page`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------- | ---- | -------- | ---- | +| page_num | num | 分页页码 | | +| page_size | num | 单页个数 | | +| total | num | 总页数 | | + +`items_lists`中的`series_list`数组: + +| 项 | 类型 | 内容 | 备注 | +| -- | ---- | ----------------- | ---- | +| 0 | obj | 第1个系列内容 | | +| 1 | obj | 第2个系列内容 | | +| …… | obj | …… | …… | +| n | obj | 第(n+1)个系列内容 | | + +`series_list`数组中的对象: + +| 字段 | 类型 | 内容 | 备注 | +| ----------- | ----- | ----------------- | ------------- | +| archives | array | 系列视频列表 | | +| meta | obj | 系列元数据 | | +| recent_aids | array | 系列视频 aid 列表 | 内容类型为num | + +`series_list`中的`archives`数组: + +同[获取视频合集信息](#获取视频合集信息)中的`archives`数组 + +`series_list`中的`meta`对象: + +| 字段 | 类型 | 内容 | 备注 | +| --------------- | ----- | -------------- | ------------- | +| category | num | 1 | | +| cover | str | 系列封面 URL | | +| creator | str | auto | | +| ctime | num | 创建时间 | Unix 时间戳 | +| description | str | 系列描述 | | +| keywords | array | 系列关键词列表 | 内容类型为str | +| last_update_ts | num | 最近更新时间 | Unix 时间戳 | +| mid | num | UP 主 ID | | +| mtime | num | 修改时间 | Unix 时间戳 | +| name | str | 系列标题 | | +| raw_keywords | str | 原始系列关键词 | | +| series_id | num | 系列 ID | | +| state | num | 2 | | +| total | num | 系列视频数量 | | + +**示例:** + +```shell +curl -G "https://api.bilibili.com/x/polymer/web-space/home/seasons_series" \ +--data-urlencode "mid=37737161" \ +--data-urlencode "page_num=1" \ +--data-urlencode "page_size=10" +``` + +
+查看响应示例: + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "items_lists": { + "page": { + "page_num": 1, + "page_size": 10, + "total": 1 + }, + "seasons_list": [], + "series_list": [ + { + "archives": [ + { + "aid": 284063097, + "bvid": "BV1Fc411x7xF", + "ctime": 1705925782, + "duration": 8885, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/5aa1bb0a121d89969e9bd2634bc7ae23272bf850.jpg", + "playback_position": 0, + "pubdate": 1705925781, + "stat": { + "view": 14683, + "vt": 0 + }, + "state": 0, + "title": "Gradle 教程 已完结 (基于Kotlin DSL讲解) 4K蓝光画质 超强的脚本式项目依赖和构建工具", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 367948632, + "bvid": "BV1P94y1c7tV", + "ctime": 1703844221, + "duration": 52036, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/499aeb41a0428e05523b766e367540b04f7c3ae2.jpg", + "playback_position": 0, + "pubdate": 1703844220, + "stat": { + "view": 82997, + "vt": 0 + }, + "state": 0, + "title": "Kotlin 教程 已完结 (IDEA 2024 最新版) 4K蓝光画质+杜比音效 零基础入门一套搞定 入门到入土经典版", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 836303388, + "bvid": "BV1Hg4y1m7Ca", + "ctime": 1705401362, + "duration": 5873, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/a20b09d1cc1a81f6a9c5ed8ea322656e406be725.jpg", + "playback_position": 0, + "pubdate": 1705401362, + "stat": { + "view": 8417, + "vt": 0 + }, + "state": 0, + "title": "Kotlin 扩展篇 已完结 (IDEA 2024 最新版) 4K蓝光画质 与Java语言混合编程", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 1, + "cover": "http://i0.hdslb.com/bfs/archive/5aa1bb0a121d89969e9bd2634bc7ae23272bf850.jpg", + "creator": "auto", + "ctime": 1705401630, + "description": "包含Kotlin语言学习的完整流程,正在不断完善中哦~", + "keywords": [ + "Kotlin" + ], + "last_update_ts": 1705925782, + "mid": 37737161, + "mtime": 1705925782, + "name": "Kotlin开心路线", + "raw_keywords": "Kotlin", + "series_id": 3908327, + "state": 2, + "total": 3 + }, + "recent_aids": [ + 284063097, + 367948632, + 836303388 + ] + }, + { + "archives": [ + { + "aid": 848832470, + "bvid": "BV1CL4y1i7qR", + "ctime": 1635258883, + "duration": 106474, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/45dddea811257f78ddd6f1e70197d95d7d6b5187.jpg", + "playback_position": 0, + "pubdate": 1635258883, + "stat": { + "view": 438645, + "vt": 0 + }, + "state": 0, + "title": "JavaWeb 教程 已完结(IDEA 2021版本)4K蓝光画质 入土到起立", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 566880413, + "bvid": "BV1Kv4y1x7is", + "ctime": 1676544280, + "duration": 25149, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/cc59de5afebc66447ba93ad9ea0ba73a9b09c117.jpg", + "playback_position": 0, + "pubdate": 1676544280, + "stat": { + "view": 87171, + "vt": 0 + }, + "state": 0, + "title": "Spring 核心教程 已完结(IDEA 2023最新版)4K蓝光画质 基于Spring6的全新重制版本 起立到起飞", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 615286308, + "bvid": "BV1Lh4y1M7kx", + "ctime": 1688117457, + "duration": 10373, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/5f860de4bc0fab30651ae93396f9c572be8380b2.jpg", + "playback_position": 0, + "pubdate": 1688117457, + "stat": { + "view": 41428, + "vt": 0 + }, + "state": 0, + "title": "Spring MVC 教程 已完结(IDEA 2023最新版)4K蓝光画质 基于Spring6的全新重制版本 起立到起飞", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 403104913, + "bvid": "BV1fV411M7aS", + "ctime": 1688560394, + "duration": 17611, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/c4557a16aa3519183d6ae0114e1c64107bb23703.jpg", + "playback_position": 0, + "pubdate": 1688560394, + "stat": { + "view": 59298, + "vt": 0 + }, + "state": 0, + "title": "Spring Security 教程 已完结(IDEA 2023最新版)4K蓝光画质 基于Spring6的全新重制版本 起立到起飞", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 828666773, + "bvid": "BV1xu4y1m7UP", + "ctime": 1689767299, + "duration": 29696, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/06cf686d4d3f7ce6731975ef59938d759283318e.jpg", + "playback_position": 0, + "pubdate": 1689767299, + "stat": { + "view": 108078, + "vt": 0 + }, + "state": 0, + "title": "Spring Boot 教程 已完结(IDEA 2023最新版)4K蓝光画质 基于SpringBoot 3 的全新重制版本 起飞到删库跑路", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 852857221, + "bvid": "BV1AL4y1j7RY", + "ctime": 1648811079, + "duration": 55544, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/629755f79c13c96c9b6d91da80257a352b29dd86.jpg", + "playback_position": 0, + "pubdate": 1648811079, + "stat": { + "view": 168251, + "vt": 0 + }, + "state": 0, + "title": "SpringCloud 教程 已完结(IDEA 2022.1最新版)4K蓝光画质 微服务开发", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 1, + "cover": "http://i0.hdslb.com/bfs/archive/45dddea811257f78ddd6f1e70197d95d7d6b5187.jpg", + "creator": "auto", + "ctime": 1669273103, + "description": "已排序完成,共4个系列,请至少完成Java SE篇视频之后再开始JavaEE路线哦~ 整个路线大致为:JavaWeb基础篇、SSM成长篇、SpringBoot成熟篇、SpringCloud进阶篇", + "keywords": [ + "" + ], + "last_update_ts": 1696249622, + "mid": 37737161, + "mtime": 1696249622, + "name": "JavaEE通关路线", + "raw_keywords": "", + "series_id": 2800548, + "state": 2, + "total": 9 + }, + "recent_aids": [ + 848832470, + 566880413, + 615286308, + 403104913, + 828666773, + 852857221 + ] + }, + { + "archives": [ + { + "aid": 445283537, + "bvid": "BV14j411S76G", + "ctime": 1687946670, + "duration": 7008, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/208bb09ecf97fbbd73e45b3839715276ffbbe8f4.jpg", + "playback_position": 0, + "pubdate": 1687946670, + "stat": { + "view": 9483, + "vt": 0 + }, + "state": 0, + "title": "Apache Maven 依赖管理 极速上手 已完结(2021 版本)4K蓝光画质+杜比音效 从导入到冲突", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 813084463, + "bvid": "BV1r34y1p7j9", + "ctime": 1656909478, + "duration": 17457, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/798135f31dc9e03121458f32825dc81d8e403887.jpg", + "playback_position": 0, + "pubdate": 1656909478, + "stat": { + "view": 46179, + "vt": 0 + }, + "state": 0, + "title": "Docker 容器技术 已完结(2022 最新版)4K蓝光画质+杜比音效 从内卷到开摆", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 432905025, + "bvid": "BV1a3411f7nh", + "ctime": 1669296029, + "duration": 10393, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/d14c0fad064a224de7afb7edd147f8b335324c53.jpg", + "playback_position": 0, + "pubdate": 1669296029, + "stat": { + "view": 37040, + "vt": 0 + }, + "state": 0, + "title": "Linux 操作系统 光速入门 已完结(2021 版本)4K蓝光画质+杜比音效 从讨厌到喜欢", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 390385576, + "bvid": "BV19d4y147Df", + "ctime": 1669272992, + "duration": 23389, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/8ba763e1a1e14c47c1c178ecf21240896d3fbb5e.jpg", + "playback_position": 0, + "pubdate": 1669272992, + "stat": { + "view": 32189, + "vt": 0 + }, + "state": 0, + "title": "MySQL 数据库技术 已完结(2021版本)4K蓝光画质+杜比音效 从内卷到开摆", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 647924810, + "bvid": "BV1ce4y1W7YB", + "ctime": 1669275447, + "duration": 8492, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/f5bcc92a4e181cb12a8b80499cea255f43f2d97b.jpg", + "playback_position": 0, + "pubdate": 1669275447, + "stat": { + "view": 20004, + "vt": 0 + }, + "state": 0, + "title": "Git 版本控制 快速上手 已完结(2021版本)4K蓝光画质+杜比音效 从开摆到放弃", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 347934006, + "bvid": "BV1vR4y1o7Z2", + "ctime": 1669295228, + "duration": 10631, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/f95d39b0bc1a2bdad07461a8f4b1ea48c174902c.jpg", + "playback_position": 0, + "pubdate": 1669295228, + "stat": { + "view": 25860, + "vt": 0 + }, + "state": 0, + "title": "Redis 缓存技术 已完结(2021版本)4K蓝光画质+杜比音效 从内卷到开摆", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 1, + "cover": "http://i1.hdslb.com/bfs/archive/208bb09ecf97fbbd73e45b3839715276ffbbe8f4.jpg", + "creator": "auto", + "ctime": 1669273164, + "description": "包含主线中讲解的中间件归档视频与当下必学的火热技术。", + "keywords": [ + "" + ], + "last_update_ts": 1688123428, + "mid": 37737161, + "mtime": 1688123428, + "name": "必学技术与中间件", + "raw_keywords": "", + "series_id": 2800550, + "state": 2, + "total": 7 + }, + "recent_aids": [ + 445283537, + 813084463, + 432905025, + 390385576, + 647924810, + 347934006 + ] + }, + { + "archives": [ + { + "aid": 900707014, + "bvid": "BV1YP4y1o75f", + "ctime": 1663494406, + "duration": 103542, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/291dd3b60b67a8f74567a81999612bd50b4e8017.jpg", + "playback_position": 0, + "pubdate": 1663494406, + "stat": { + "view": 312144, + "vt": 0 + }, + "state": 0, + "title": "JavaSE 教程 已完结 (IDEA 2022 最新版) 4K蓝光画质+杜比音效 零基础入门一套搞定 入门到入土", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 604837097, + "bvid": "BV1G84y1v7Vj", + "ctime": 1667815711, + "duration": 19395, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/4a4522194a1d0c8ae684976b26fb2fe43ce28f39.jpg", + "playback_position": 0, + "pubdate": 1667815711, + "stat": { + "view": 74496, + "vt": 0 + }, + "state": 0, + "title": "JavaSE AWT/Swing 图形化编程 (IDEA 2022 最新版) 4K蓝光画质+杜比音效 快速上手桌面程序 用IDEA写IDEA", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 766688029, + "bvid": "BV1Er4y1r7as", + "ctime": 1645157763, + "duration": 21585, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/ced6a8c8548f0f921f306ea3589f9d470adc0446.jpg", + "playback_position": 0, + "pubdate": 1645157763, + "stat": { + "view": 133409, + "vt": 0 + }, + "state": 0, + "title": "Java JVM 虚拟机 已完结(IDEA 2021版本)4K蓝光画质 全程劝退", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 936955310, + "bvid": "BV1JT4y1S7K8", + "ctime": 1646391131, + "duration": 31736, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/9347ef3cdb6cf0e5bca29ce32e211b488e90ab7b.jpg", + "playback_position": 0, + "pubdate": 1646391131, + "stat": { + "view": 74731, + "vt": 0 + }, + "state": 0, + "title": "Java JUC 并发编程 已完结(IDEA 2021版本)4K蓝光画质 玩转多线程", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 768437265, + "bvid": "BV1ar4y1J7mC", + "ctime": 1650881312, + "duration": 26314, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/7f97549147c09a386d9402b121cc6206c36e4079.jpg", + "playback_position": 0, + "pubdate": 1650881312, + "stat": { + "view": 67900, + "vt": 0 + }, + "state": 0, + "title": "Java NIO Netty网络编程 已完结(IDEA 2022.1最新版)4K蓝光画质 网络I/O进阶编程", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 684547077, + "bvid": "BV1tU4y1y7Fg", + "ctime": 1653900327, + "duration": 10243, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/dc0cc9464c6fc274c1f23f682a01dab5a358217b.jpg", + "playback_position": 0, + "pubdate": 1653900327, + "stat": { + "view": 47693, + "vt": 0 + }, + "state": 0, + "title": "JavaSE 9-17 新特性 已完结(IDEA 2022.1最新版)4K蓝光画质 Java9/10/11/12/13/14/15/16/17讲解", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 1, + "cover": "http://i0.hdslb.com/bfs/archive/291dd3b60b67a8f74567a81999612bd50b4e8017.jpg", + "creator": "auto", + "ctime": 1648810702, + "description": "已排序完成,共3个系列,完成JavaSE篇之后,就可以开启JavaEE路线了", + "keywords": [ + "" + ], + "last_update_ts": 1667816253, + "mid": 37737161, + "mtime": 1667816253, + "name": "JavaSE基础路线", + "raw_keywords": "", + "series_id": 2158988, + "state": 2, + "total": 6 + }, + "recent_aids": [ + 900707014, + 604837097, + 766688029, + 936955310, + 768437265, + 684547077 + ] + }, + { + "archives": [ + { + "aid": 770027221, + "bvid": "BV1Cr4y137os", + "ctime": 1655371329, + "duration": 48185, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/5d9bd135f068e623e50c7341244635f6cc96c3ea.jpg", + "playback_position": 0, + "pubdate": 1655371329, + "stat": { + "view": 275378, + "vt": 0 + }, + "state": 0, + "title": "C语言程序设计 已完结(CLion 2022 最新版)4K蓝光画质+杜比音效 梦开始的地方", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 941207928, + "bvid": "BV13W4y127Ey", + "ctime": 1658474799, + "duration": 69081, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/0bf055a0961c0f9bbb7f869b47c3e3d7df21f55c.jpg", + "playback_position": 0, + "pubdate": 1658474798, + "stat": { + "view": 220072, + "vt": 0 + }, + "state": 0, + "title": "数据结构与算法 已完结(CLion 2022 最新版)4K蓝光画质+杜比音效 全程高能", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 426681358, + "bvid": "BV1u3411P7Na", + "ctime": 1653033628, + "duration": 12346, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i0.hdslb.com/bfs/archive/4174e2976f750d5410d6cef374c3035190717cac.jpg", + "playback_position": 0, + "pubdate": 1653033628, + "stat": { + "view": 71911, + "vt": 0 + }, + "state": 0, + "title": "Java 设计模式 已完结(IDEA 2022.1最新版)4K蓝光画质+杜比音效", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 1, + "cover": "http://i0.hdslb.com/bfs/archive/5d9bd135f068e623e50c7341244635f6cc96c3ea.jpg", + "creator": "auto", + "ctime": 1653296733, + "description": "Java设计模式系列视频,提升你的代码编写规范。", + "keywords": [ + "" + ], + "last_update_ts": 1658735292, + "mid": 37737161, + "mtime": 1658735292, + "name": "高等院校计算机必修课", + "raw_keywords": "", + "series_id": 2318088, + "state": 2, + "total": 3 + }, + "recent_aids": [ + 770027221, + 941207928, + 426681358 + ] + } + ] + } + } +} +``` + +## 获取系列和合集视频 + +> https://api.bilibili.com/x/polymer/web-space/seasons_series_list + +*请求方式: GET* + +鉴权方式: 请求头 User-Agent 为正常浏览器, 若仍被风控则请求头再带上 Referer 为 `.bilibili.com` 下任意页 + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | -------- | ------ | ---- | +| mid | num | 用户 mid | 必要 | | +| page_num | num | 页码 | 必要 | 默认为 1 | +| page_size | num | 每页数量 | 必要 | 默认为 20 | +| w_rid | str | WBI 签名 | 可选 | 参见 [WBI 签名](../misc/sign/wbi.md) | +| wts | num | UNIX 秒级时间戳 | 可选 | 参见 [WBI 签名](../misc/sign/wbi.md) | +| web_location | str | 页面位置? | 可选 | 333.999 | + +**JSON回复:** + +与 [只获取系列视频](#只获取系列视频) 基本一致, 但 `.data.items_lists.seasons_list` 数组不为空, +且该数组中的元素结构与 `.data.items_lists.series_list` 相同, 略 + +**示例:** + +获取 `mid=37737161` 的系列视频列表,每页 5 条,页码为 1 + +```shell +curl -G "https://api.bilibili.com/x/polymer/web-space/seasons_series_list" \ +--data-urlencode "mid=37737161" \ +--data-urlencode "page_num=1" \ +--data-urlencode "page_size=5" \ +--data-urlencode "w_rid=xxx" \ +--data-urlencode "wts=xxx" +``` + +
+查看响应示例: + +```jsonc +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "items_lists": { + "page": { + "page_num": 1, + "page_size": 5, + "total": 9 + }, + "seasons_list": [ + { + "archives": [ + { + "aid": 343807541, + "bvid": "BV1t94y1D79E", + "ctime": 1658907465, + "duration": 2164, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i1.hdslb.com/bfs/archive/0af0faa77a1921db4cf86c115db70aa2594983f0.jpg", + "playback_position": 0, + "pubdate": 1658907465, + "stat": { + "view": 43096, + "vt": 0 + }, + "state": 0, + "title": "Java学习路线两条龙版,让你不再迷茫!包含各个知识点梳理,常用技术栈介绍等。", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 429032764, + "bvid": "BV11G411h7NB", + "ctime": 1659499261, + "duration": 197, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/5235a0ab2738e288b08654aa8e0cd3a509a7ef96.jpg", + "playback_position": 0, + "pubdate": 1659499200, + "stat": { + "view": 22700, + "vt": 0 + }, + "state": 0, + "title": "好书推荐《On Java》都什么年代了,还在看传统Java书籍?", + "ugc_pay": 0, + "vt_display": "" + }, + // ... + ], + "meta": { + "category": 0, + "cover": "https://archive.biliimg.com/bfs/archive/27733cf13514d990c880154b937cd8633f583aa4.jpg", + "description": "除教程视频外其他的视频,均在此。", + "mid": 37737161, + "name": "合集·拾枝杂谈", + "ptime": 1694682652, + "season_id": 587216, + "total": 10 + }, + "recent_aids": [ + 343807541, + 429032764, + 857089796, + 560181990, + 774119786, + 859397126 + ] + }, + { + "archives": [ + { + "aid": 311606079, + "bvid": "BV1XN411K7g9", + "ctime": 1679651747, + "duration": 261, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/234e6bd061176dba9e148f4373c52fa7cd2d801f.jpg", + "playback_position": 0, + "pubdate": 1679651747, + "stat": { + "view": 12150, + "vt": 0 + }, + "state": 0, + "title": "某些IT社区平台乱象,文章千篇一律,毫不注重版权,文章互相抄袭成潮流,希望能够好好管管!", + "ugc_pay": 0, + "vt_display": "" + }, + { + "aid": 400546145, + "bvid": "BV1qo4y1L73P", + "ctime": 1682777426, + "duration": 335, + "enable_vt": false, + "interactive_video": false, + "pic": "http://i2.hdslb.com/bfs/archive/a6b6fb0330bbf6c500720a024e5a9ade24d888c3.jpg", + "playback_position": 0, + "pubdate": 1682777425, + "stat": { + "view": 52744, + "vt": 0 + }, + "state": 0, + "title": "某些搜索引擎得到的结果,官方网站反而排在一些诈骗广告后面,诱导用户下载大量捆绑垃圾软件", + "ugc_pay": 0, + "vt_display": "" + } + ], + "meta": { + "category": 0, + "cover": "https://archive.biliimg.com/bfs/archive/5e1c1f77c3065ec31eec43d7e35f7a061602e4d6.jpg", + "description": "白马首席讲师吐槽系列视频", + "mid": 37737161, + "name": "合集·水浅王八多,真假白马说", + "ptime": 1682777425, + "season_id": 1227671, + "total": 2 + }, + "recent_aids": [ + 311606079, + 400546145 + ] + }, + // ... + ], + "series_list": [ + // 与前接口基本相同 + ] + } + } +} +``` + +
+ +## 查询指定系列 + +> https://api.bilibili.com/x/series/series + +*请求方式: GET* + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | -------- | ------ | ---- | +| series_id | num | 系列ID | 必要 | | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------- | +| code | num | 返回值 | 0:成功 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------------ | ---- | ------------ | ---- | +| meta | obj | 系列信息 | | +| recent_aids | array | 系列 aid 列表 | 内容类型为 num | + +`data`中的`meta`对象: + +同[只获取系列视频](#只获取系列视频)中的`meta`对象 + +**示例:** + +```shell +curl -G 'https://api.bilibili.com/x/series/series' \ +--data-urlencode 'series_id=2158988' +``` + +
+查看响应示例 + +```json +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "meta": { + "series_id": 2158988, + "mid": 37737161, + "name": "JavaSE基础路线", + "description": "已排序完成,共3个系列,完成JavaSE篇之后,就可以开启JavaEE路线了", + "keywords": [ + "" + ], + "creator": "auto", + "state": 2, + "last_update_ts": 1667816253, + "total": 6, + "ctime": 1648810702, + "mtime": 1667816253, + "raw_keywords": "", + "category": 1 + }, + "recent_aids": [ + 900707014, + 604837097, + 766688029, + 936955310, + 768437265, + 684547077 + ] + } +} +``` + +
+ +## 获取指定系列视频 + +> https://api.bilibili.com/x/series/archives + +*请求方式: GET* + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------ | ---- | -------- | ------ | ---- | +| mid | num | 用户 mid | 必要 | | +| series_id | num | 系列ID | 必要 | | +| only_normal | bool | 作用尚不明确 | 可选 | 默认为 true | +| sort | str | 排序方式 | 可选 | desc: 默认排序
asc: 升序排序 | +| pn | num | 页码 | 可选 | 默认为 1 | +| ps | num | 每页数量 | 可选 | 默认为 20 | +| current_mid | num | 当前用户 mid | 可选 | 用于 `playback_position` 播放进度 | + +**JSON回复:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------- | ---- | -------- | ------- | +| code | num | 返回值 | 0:成功 | +| message | str | 错误信息 | 默认为0 | +| ttl | num | 1 | | +| data | obj | 信息本体 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ------------ | ---- | ------------ | ---- | +| aids | array | 视频 aid 列表 | 内容类型为 num | +| page | obj | 页码信息 | | +| archives | array | 视频信息列表 | | + +`data`中的`page`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | -------- | ---- | +| num | num | 当前页码 | | +| size | num | 每页数量 | | +| total | num | 视频总数 | | + +`data`中的`archives`数组: + +基本同[获取视频合集信息](#获取视频合集信息)中的`archives`数组 + +**示例:** + +获取 `mid=39665558` 的 `series_id=534501` 系列视频列表,每页 16 条,页码为 1,默认排序, 当前用户 mid 为 `1070915568` + +```shell +curl -G "https://api.bilibili.com/x/series/archives" \ +--data-urlencode "mid=39665558" \ +--data-urlencode "series_id=534501" \ +--data-urlencode "only_normal=true" \ +--data-urlencode "sort=desc" \ +--data-urlencode "pn=1" \ +--data-urlencode "ps=16" \ +--data-urlencode "current_mid=1070915568" +``` + +
+查看响应示例: + +```jsonc +{ + "code": 0, + "message": "0", + "ttl": 1, + "data": { + "aids": [ + 695029098, + 724599872, + 594794875, + 41565264, + 541053051, + 499696652, + 673071936, + 462891077, + 973903762, + 61692380, + 336713491, + 372661682, + 550840795, + 51839931, + 718592873, + 87838863 + ], + "page": { + "num": 1, + "size": 16, + "total": 25 + }, + "archives": [ + { + "aid": 695029098, + "title": "Python控制Minecraft教程(下):自动建造", + "pubdate": 1677321251, + "ctime": 1677321251, + "state": 0, + "pic": "http://i1.hdslb.com/bfs/archive/187c0ba21b9ceba908a8760e83d49f466316824b.jpg", + "duration": 275, + "stat": { + "view": 26555 + }, + "bvid": "BV1k24y1J78X", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 724599872, + "title": "『教程』一看就懂!Github基础教程", + "pubdate": 1646740815, + "ctime": 1646740824, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/1401ebe64e88deddf2b44ad6a740ff8872c2fda6.jpg", + "duration": 296, + "stat": { + "view": 2412054 + }, + "bvid": "BV1hS4y1S7wL", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 594794875, + "title": "『教程』手把手教你流畅访问Github", + "pubdate": 1647345613, + "ctime": 1647336725, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/71cc640a84087cc99399449c00b93212fe78ee6f.jpg", + "duration": 236, + "stat": { + "view": 910491 + }, + "bvid": "BV1Aq4y1q7hr", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 41565264, + "title": "《Python负基础到入门教程》专为\"非计算机专业和编程困难户\"制作(全13集 配音字幕重制版)", + "pubdate": 1548316071, + "ctime": 1548316072, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/5f4f6acfc00723c84f726d35add94b1d4b4ee482.jpg", + "duration": 6395, + "stat": { + "view": 261286 + }, + "bvid": "BV1et411b76c", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 541053051, + "title": "『教程』文字频频乱码 这背后是显卡的扭曲还是规则的沦丧?", + "pubdate": 1592996906, + "ctime": 1592996907, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/8a3c3e3d01a91776763d34bba79add698869c82d.jpg", + "duration": 381, + "stat": { + "view": 1184937 + }, + "bvid": "BV1ai4y1x7Uz", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 499696652, + "title": "『教程』VsCode五分钟上手教程 无一句废话", + "pubdate": 1601207369, + "ctime": 1601207369, + "state": 0, + "pic": "http://i1.hdslb.com/bfs/archive/cb78c07a090ed456bdcc217b0417670867772a29.jpg", + "duration": 329, + "stat": { + "view": 417610 + }, + "bvid": "BV1bK411P767", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 673071936, + "title": "『教程』补码怎么来的?", + "pubdate": 1620994814, + "ctime": 1620986531, + "state": 0, + "pic": "http://i1.hdslb.com/bfs/archive/12c02599321a0b1386b29ddc4653ff7df9bd54b4.jpg", + "duration": 445, + "stat": { + "view": 247578 + }, + "bvid": "BV16U4y1t7LD", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 462891077, + "title": "『教程』回调函数是个啥?", + "pubdate": 1631274885, + "ctime": 1631274885, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/df294350462558601f65b743ca25e2fdc01de628.jpg", + "duration": 452, + "stat": { + "view": 213895 + }, + "bvid": "BV1vL411t78b", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 98 + }, + { + "aid": 973903762, + "title": "『教程』堆栈是个啥?", + "pubdate": 1625227205, + "ctime": 1625227209, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/bf7956b6311ec0787fd52d1293bb4287d16b7e65.jpg", + "duration": 370, + "stat": { + "view": 535174 + }, + "bvid": "BV1P44y1q7uL", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 99 + }, + { + "aid": 61692380, + "title": "『教程』什么是递归?", + "pubdate": 1564660818, + "ctime": 1564637347, + "state": 0, + "pic": "http://i1.hdslb.com/bfs/archive/4af853671204b9bc631fada1934a3e86145a7d19.jpg", + "duration": 658, + "stat": { + "view": 487397 + }, + "bvid": "BV194411f71o", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 79 + }, + { + "aid": 336713491, + "title": "『教程』几分钟听懂迭代器", + "pubdate": 1636713476, + "ctime": 1636713476, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/6e255cce7c0303ab0211acd0f9d1ec5980ff03f7.jpg", + "duration": 453, + "stat": { + "view": 110688 + }, + "bvid": "BV18R4y1t7Hg", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 97 + }, + { + "aid": 372661682, + "title": "『教程』桌面精灵是怎样实现的?", + "pubdate": 1604916264, + "ctime": 1604916264, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/aaa8bb7b6fced63dd4792e28c1f78ba903fcc4cc.jpg", + "duration": 326, + "stat": { + "view": 168775 + }, + "bvid": "BV1aZ4y1V7aa", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 550840795, + "title": "『教程』什么是钩子技术?", + "pubdate": 1642744335, + "ctime": 1642744335, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/380b1ff9726c673411cf916b03268c7fb16aff68.jpg", + "duration": 240, + "stat": { + "view": 237568 + }, + "bvid": "BV1Cq4y1c7kK", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 51839931, + "title": "『教程』学编程前必知的8个电脑操作", + "pubdate": 1557313623, + "ctime": 1557313623, + "state": 0, + "pic": "http://i2.hdslb.com/bfs/archive/b54535ee3ff27006912d8013f2ea1667b2a50f80.jpg", + "duration": 641, + "stat": { + "view": 139385 + }, + "bvid": "BV1t4411v78E", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + }, + { + "aid": 718592873, + "title": "『教程』这些常见编程单词到底该怎么读?看你能否读对?对✔❌✅☑", + "pubdate": 1634300675, + "ctime": 1634265090, + "state": 0, + "pic": "http://i1.hdslb.com/bfs/archive/de43275f44aea9f6d79c13ee68c6dcdfc9e5fc5e.jpg", + "duration": 783, + "stat": { + "view": 81193 + }, + "bvid": "BV1JQ4y1D79p", + "ugc_pay": 0, + "interactive_video": true, + "enable_vt": 0, + "vt_display": "", + "playback_position": 100 + }, + { + "aid": 87838863, + "title": "『教程』什么是环境变量", + "pubdate": 1581258353, + "ctime": 1581258353, + "state": 0, + "pic": "http://i0.hdslb.com/bfs/archive/331b2304d8262c4252f338599846761d6a5a8e0c.jpg", + "duration": 353, + "stat": { + "view": 99797 + }, + "bvid": "BV1w741147G9", + "ugc_pay": 0, + "interactive_video": false, + "enable_vt": 0, + "vt_display": "", + "playback_position": 0 + } + ] + } +} +``` diff --git a/docs/video/info.md b/docs/video/info.md index 8fc4101..868fe1f 100644 --- a/docs/video/info.md +++ b/docs/video/info.md @@ -4,6 +4,7 @@ ## 获取视频详细信息(web端) +> https://api.bilibili.com/x/web-interface/wbi/view > https://api.bilibili.com/x/web-interface/view *请求方式:GET* diff --git a/docs/video/report.md b/docs/video/report.md index 395a007..3f3d75c 100644 --- a/docs/video/report.md +++ b/docs/video/report.md @@ -78,28 +78,58 @@ curl 'https://api.bilibili.com/x/v2/history/report' \ 认证方式:仅可Cookie(SESSDATA) -默认间隔15秒一次 +默认间隔15秒一次, 亦可记录播放历史 -亦可记录播放历史 +尽管以下除正文 `aid` 以外的参数均为非必要, 但缺少可能会导致播放不被记录, 同一 IP/登陆用户 每五分钟最多记录一次播放 + +该接口较为复杂, 且参数计算方法均为推测, 实际过程不明, 可能含有错误, 若要正式使用可以把已播放的持续时间全都设为相同值 + +**URL参数:** + +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ------------------------- | ---- | ------------------------------ | ------ | ------- | +| w_start_ts | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | UNIX 秒级时间戳 | +| w_mid | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | | +| w_aid | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | | +| w_dt | num | 2 | 非必要 | | +| w_realtime | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | 单位 秒 | +| w_playedtime | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | 单位 秒 | +| w_real_played_time | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | 单位 秒 | +| w_video_duration | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | 单位 秒 | +| w_last_play_progress_time | num | 参见请求正文同名无`w_`前缀参数 | 非必要 | 单位 秒 | +| web_location | num | 网页位置 | 非必要 | 视频详情页播放器: 1315873 | +| w_rid | num | WBI 签名 | 非必要 | 参见[WBI 签名](docs/misc/sign/wbi.md) | +| wts | num | UNIX 秒级时间戳 | 非必要 | 参见[WBI 签名](docs/misc/sign/wbi.md) | **正文参数( application/x-www-form-urlencoded ):** -| 参数名 | 类型 | 内容 | 必要性 | 备注 | -| ----------- | ---- | ------------------------ | ------------ | ------------------------------------------------------------ | -| aid | num | 稿件avid | 必要(可选) | avid与bvid任选一个 | -| bvid | str | 稿件bvid | 必要(可选) | avid与bvid任选一个 | -| cid | num | 视频cid | 非必要 | 用于识别分P | -| epid | num | 番剧epid | 非必要 | | -| sid | num | 番剧ssid | 非必要 | | -| mid | num | 当前用户mid | 非必要 | | -| played_time | num | 视频播放进度 | 非必要 | 单位为秒
默认为0 | -| realtime | num | 总计播放时间 | 非必要 | 单位为秒 | -| start_ts | num | 开始播放时刻 | 非必要 | 时间戳 | -| type | num | 视频类型 | 非必要 | 3:投稿视频
4:剧集
10:课程 | -| sub_type | num | 剧集副类型 | 非必要 | 当`type=4`时本参数有效
1:番剧
2:电影
3:纪录片
4:国创
5:电视剧
7:综艺 | -| dt | num | 2 | 非必要 | | -| play_type | num | 播放动作 | 非必要 | 0:播放中
1:开始播放
2:暂停
3:继续播放 | -| csrf | str | CSRF Token(位于cookie) | 非必要 | | +| 参数名 | 类型 | 内容 | 必要性 | 备注 | +| ----------------------- | ---- | ---------------------------------- | ------------ | ----------------------------------------------------------- | +| aid | num | 稿件avid | 必要(可选) | avid与bvid任选一个(网页端请求默认仅使用aid) | +| bvid | str | 稿件bvid | 必要(可选) | avid与bvid任选一个 | +| cid | num | 视频cid | 非必要 | 用于识别分P | +| epid | num | 番剧epid | 非必要 | | +| sid | num | 番剧ssid | 非必要 | | +| mid | num | 当前用户mid | 非必要 | | +| played_time | num | 视频播放进度 | 非必要 | 单位 秒
播放完成为 -1 | +| realtime | num | 本轮页面会话真实播放时间 | 非必要 | 单位 秒 | +| real_played_time | num | 本轮页面会话真实视频播放持续时间 | 非必要 | 单位 秒 | +| refer_url | str | 与请求头 Referer 字段相同 | 非必要 | | +| quality | num | 视频清晰度 | 非必要 | 参见[qn视频清晰度标识](videostream_url.md#qn视频清晰度标识) | +| video_duration | num | 视频时长 | 非必要 | 单位 秒 | +| last_play_progress_time | num | play_time 与 本轮页面会话开始时 played_time 之和 | 非必要 | 单位 秒 | +| max_play_progress_time | num | 本轮页面会话所有最大 last_play_progress_time 与 本轮页面会话开始时 played_time 之和 | 非必要 | 单位 秒 | +| start_ts | num | 开始播放时刻 | 非必要 | 时间戳 | +| type | num | 视频类型 | 非必要 | 3:投稿视频
4:剧集
10:课程 | +| sub_type | num | 剧集副类型 | 非必要 | 0: 普通投稿视频
1:番剧
2:电影
3:纪录片
4:国创
5:电视剧
7:综艺 | +| dt | num | 2 | 非必要 | | +| outer | num | 0 | 非必要 | | +| spmid | str | 333.788.0.0 | 非必要 | 作用尚不明确 | +| from_spmid | str | 播放来源? | 非必要 | 也可为空, 如: 444.41.list.card_archive.click | +| session | str | 会话信息? | 非必要 | 每次刷新均不同, 生成原理尚不明确 | +| extra | obj | 额外信息, 如播放器版本 | 非必要 | 如: `{"player_version":"4.8.36"}` | +| play_type | num | 播放动作 | 非必要 | 0:播放中
1:开始播放
2:暂停
3:继续播放
4: 结束播放 | +| csrf | str | CSRF Token(即 Cookie 中 bili_jct) | 非必要 | | **json回复:** From cb4f767d4ee3f4f66b6caff04c9c40164ea4af54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=91=89=20Scarlet?= <93977077+MukjepScarlet@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:03:09 +0800 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0wbi=E5=8A=A0?= =?UTF-8?q?=E7=AD=BE=E7=9A=84Kotlin=E5=AE=9E=E7=8E=B0,=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96Java=E5=AE=9E=E7=8E=B0=20(#1068)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/misc/sign/wbi.md | 157 ++++++++++++++++++++++++++++++++---------- 1 file changed, 120 insertions(+), 37 deletions(-) diff --git a/docs/misc/sign/wbi.md b/docs/misc/sign/wbi.md index 358bc5f..2c2d55f 100644 --- a/docs/misc/sign/wbi.md +++ b/docs/misc/sign/wbi.md @@ -120,7 +120,7 @@ ## Demo -含 [Python](#Python)、[JavaScript](#JavaScript)、[Golang](#Golang)、[C#](#CSharp)、[Java](#Java)、[Swift](#Swift)、[C++](#CPlusPlus)、[Rust](#Rust) 语言编写的 Demo 。 +含 [Python](#Python)、[JavaScript](#JavaScript)、[Golang](#Golang)、[C#](#CSharp)、[Java](#Java)、[Kotlin](#Kotlin)、[Swift](#Swift)、[C++](#CPlusPlus)、[Rust](#Rust) 语言编写的 Demo 。 ### Python @@ -658,14 +658,13 @@ bar=514&baz=1919810&foo=114&wts=1687541921&w_rid=26e82b1b9b3a11dbb1807a9228a40d3 ### Java -需要 `hutool` 依赖 - ```java -package com.example.demo; - -import cn.hutool.crypto.SecureUtil; - +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.*; +import java.util.stream.Collectors; public class WbiTest { private static final int[] mixinKeyEncTab = new int[]{ @@ -675,42 +674,126 @@ public class WbiTest { 36, 20, 34, 44, 52 }; + private static final char[] hexDigits = "0123456789abcdef".toCharArray(); + + public static String md5(String input) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] messageDigest = md.digest(input.getBytes(StandardCharsets.UTF_8)); + char[] result = new char[messageDigest.length * 2]; + for (int i = 0; i < messageDigest.length; i++) { + result[i * 2] = hexDigits[(messageDigest[i] >> 4) & 0xF]; + result[i * 2 + 1] = hexDigits[messageDigest[i] & 0xF]; + } + return new String(result); + } catch (NoSuchAlgorithmException e) { + return null; + } + } + public static String getMixinKey(String imgKey, String subKey) { String s = imgKey + subKey; StringBuilder key = new StringBuilder(); - for (int i = 0; i < 32; i++) { + for (int i = 0; i < 32; i++) key.append(s.charAt(mixinKeyEncTab[i])); - } return key.toString(); } - public static void main(String[] args) { - String imgKey = "653657f524a547ac981ded72ea172057"; - String subKey = "6e4909c702f846728e64f6007736a338"; - String mixinKey = getMixinKey(imgKey, subKey); - System.out.println(mixinKey); - //72136226c6a73669787ee4fd02a74c27 - //{ - // foo: 'one one four', - // bar: '五一四', - // baz: 1919810 - //} - LinkedHashMap map = new LinkedHashMap<>(); - map.put("foo", "one one four"); - map.put("bar", "五一四"); - map.put("baz", 1919810); - map.put("wts", System.currentTimeMillis() / 1000); - StringJoiner param = new StringJoiner("&"); - //排序 + 拼接字符串 - map.entrySet().stream() - .sorted(Map.Entry.comparingByKey()) - .forEach(entry -> param.add(entry.getKey() + "=" + URLUtil.encode(entry.getValue().toString()))); - String s = param + mixinKey; - String wbiSign = SecureUtil.md5(s); - System.out.println(wbiSign); - String finalParam = param + "&w_rid=" + wbiSign; - System.out.println(finalParam); - } + public static String encodeURIComponent(Object o) { + return URLEncoder.encode(o.toString(), StandardCharsets.UTF_8).replace("+", "%20"); + } + + public static void main(String[] args) { + String imgKey = "653657f524a547ac981ded72ea172057"; + String subKey = "6e4909c702f846728e64f6007736a338"; + String mixinKey = getMixinKey(imgKey, subKey); + System.out.println(mixinKey); // 72136226c6a73669787ee4fd02a74c27 + + // 用TreeMap自动排序 + TreeMap map = new TreeMap<>(); + map.put("foo", "one one four"); + map.put("bar", "五一四"); + map.put("baz", 1919810); + map.put("wts", System.currentTimeMillis() / 1000); + String param = map.entrySet().stream() + .map(it -> String.format("%s=%s", it.getKey(), encodeURIComponent(it.getValue()))) + .collect(Collectors.joining("&")); + String s = param + mixinKey; + + String wbiSign = md5(s); + System.out.println(wbiSign); + String finalParam = param + "&w_rid=" + wbiSign; + System.out.println(finalParam); + } +} +``` + +### Kotlin + +```kotlin +import java.net.URLEncoder +import java.nio.charset.StandardCharsets +import java.security.MessageDigest + +private val hexDigits = "0123456789abcdef".toCharArray() + +fun ByteArray.toHexString() = buildString(this.size shl 1) { + this@toHexString.forEach { byte -> + append(hexDigits[byte.toInt() ushr 4 and 15]) + append(hexDigits[byte.toInt() and 15]) + } +} + +fun String.toMD5(): String { + val md = MessageDigest.getInstance("MD5") + val digest = md.digest(this.toByteArray()) + return digest.toHexString() +} + +private val mixinKeyEncTab = intArrayOf( + 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, + 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, + 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, + 36, 20, 34, 44, 52 +) + +fun getMixinKey(imgKey: String, subKey: String): String { + val s = imgKey + subKey + return buildString { + repeat(32) { + append(s[mixinKeyEncTab[it]]) + } + } +} + +fun Any.encodeURIComponent() = + URLEncoder.encode(this.toString(), StandardCharsets.UTF_8).replace("+", "%20") + +fun encWbi(params: Map, imgKey: String, subKey: String): String { + val mixinKey = getMixinKey(imgKey, subKey) + val s = params.toSortedMap().let { + it["wts"] to System.currentTimeMillis() / 1000 + it.entries.joinToString("&") { (k, v) -> + "${k.encodeURIComponent()}=${v.encodeURIComponent()}" + } + } + return "$s&w_rid=${(s + mixinKey).toMD5()}" +} + +fun main() { + val imgKey = "653657f524a547ac981ded72ea172057" + val subKey = "6e4909c702f846728e64f6007736a338" + val mixinKey = getMixinKey(imgKey, subKey) + println(mixinKey) // 72136226c6a73669787ee4fd02a74c27 + + // 需要加签的参数 + val param = mapOf( + "foo" to "one+one four", + "bar" to "五一四", + "baz" to 1919810, + ) + + println(encWbi(param, imgKey, subKey)) } ``` @@ -1214,4 +1297,4 @@ int main() { ```text avid=1755630705&cid=1574294582&fnval=4048&fnver=0&fourk=1&qn=32&wts=1717922933&w_rid=43571b838a1611fa121189083cfc1784 -``` \ No newline at end of file +```