返回提交历史
Modified
message/private_msg.md
+22
-3
XFEstudio/bilibili-API-collect
更新私信所需参数 (#195)
* 更新发送私信所需参数 * 误打了个点 Co-authored-by: imba97 <imba97@AppledeMac-mini.local>
a3460b9
代码差异
1 个文件
+22
-3
@@ -69,16 +69,35 @@ curl 'http://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread' \
69
69
70
70
**正文参数(application/x-www-form-urlencoded):**
71
71
72
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
72
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
73
73
| ------------------ | ------------------------------------ | ------------------------ | ------ | -------------------------------------- |
74
74
| msg[sender_uid] | num | 发送者UID | 必要 | |
75
75
| msg[receiver_id] | num | 接收者UID | 必要 | |
76
76
| msg[receiver_type] | num | 1 | 必要 | 固定为1 |
77
| msg[msg_type] | num | 消息类型 | 必要 | 1:发送文字<br>2:发送图片<br>5:撤回消息 |
77
| msg[msg_type] | num | 消息类型 | 必要 | 1:发送文字<br>2:发送图片<br>5:撤回消息 |
78
78
| msg[msg_status] | num | 0 | 非必要 | |
79
| msg[content] | 发送文字时:str<br />撤回消息时:num | 消息内容 | 必要 | **详见下表** |
79
| msg[dev_id] | string | 372778FD-E359-461D-86A3-EA2BCC6FF52A | 必要 | **获取方式在下面** |
80
| msg[timestamp] | num | 时间戳(秒) | 必要 | |
81
| msg[content] | 发送文字时:str<br />撤回消息时:num | 消息内容 | 必要 | **详见下表** |
80
82
| csrf_token | str | CSRF Token(位于cookie) | 必要 | |
81
83
84
---
85
86
**dev_id的获取**
87
88
以JS为例:
89
90
```javascript
91
const deviceid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function (name) {
92
let randomInt = 16 * Math.random() | 0;
93
return ("x" === name ? randomInt : 3 & randomInt | 8).toString(16).toUpperCase()
94
}));
95
```
96
97
代码来自 [andywang425/BLTH](https://github.com/andywang425/BLTH/blob/45fe93e31754ca8bf07059d46266398e787dbf45/B%E7%AB%99%E7%9B%B4%E6%92%AD%E9%97%B4%E6%8C%82%E6%9C%BA%E5%8A%A9%E6%89%8B.js#L6618)
98
99
---
100
82
101
`msg[content]`消息内容:
83
102
84
103
当发送文字时(`msg[msg_type]=1`):