mirror of
https://github.com/SocialSisterYi/bilibili-API-collect.git
synced 2024-12-27 13:00:29 +08:00
添加私信消息记录API (#382)
* Update private_msg.md 私信消息记录 * Update private_msg.md
This commit is contained in:
parent
d4f20b5a37
commit
f26768435b
@ -2,7 +2,7 @@
|
||||
|
||||
- [未读私信数](#未读私信数)
|
||||
- [发送私信(web端)](#发送私信web端)
|
||||
|
||||
- [私信消息记录](#私信消息记录)
|
||||
---
|
||||
|
||||
## 未读私信数
|
||||
@ -165,7 +165,7 @@ public class Util{
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ------------- | ---- | ---------- | ------------ |
|
||||
| msg_key | num | 消息唯一id | |
|
||||
| msg_key| num | 消息唯一id | |
|
||||
| msg_content | str | 发送的消息 | |
|
||||
| key_hit_infos | obj | | 作用尚不明确 |
|
||||
|
||||
@ -235,3 +235,140 @@ curl 'http://api.vc.bilibili.com/web_im/v1/web_im/send_msg' \
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 私信消息记录
|
||||
|
||||
> https://api.vc.bilibili.com/svr_sync/v1/svr_sync/fetch_session_msgs
|
||||
|
||||
*请求方式:GET*
|
||||
|
||||
此接口有设计缺陷,能够获取已经撤回,无法显示(如 发送私信 中msg[msg_type]:3)的消息
|
||||
|
||||
认证方式:Cookie(SESSDATA)
|
||||
|
||||
**url参数:**
|
||||
|
||||
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
||||
| ------ | ---- | -------- | ------------ | ------------------ |
|
||||
| sender_device_id | num | 发送者设备 | 可选 | 1 |
|
||||
| talker_id | num | 聊天对象的UID | 必要 | -------------- |
|
||||
| session_type | num | 聊天对象的类型 | 必要 | 1为用户,2为粉丝团 |
|
||||
| size | num | 列出消息条数 | 可选 | 默认是20 |
|
||||
| build | num | 未知 | 可选 | 默认是0 |
|
||||
| mobi_app | str | 设备 | 可选 | web |
|
||||
|
||||
**json回复:**
|
||||
|
||||
根对象:
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ------- | ------ | -------- | ---------------------------- |
|
||||
| code | num | 返回值 | 0:成功 <br />-400:请求错误 |
|
||||
| msg | str | 错误信息 | 默认为0 |
|
||||
| message | str | 错误信息 | 默认为0 |
|
||||
| ttl | num | 1 | |
|
||||
| data | array | 数据列表 | |
|
||||
|
||||
`data`数组:
|
||||
|
||||
| 项 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ------------- | ---- |
|
||||
| messages | array | 聊天记录列表 | |
|
||||
| has_more | num | 0 | |
|
||||
| min_seqno | num | 未知 | |
|
||||
| max_seqno | num | 未知 | |
|
||||
| e_infos | array | 聊天表情列表 | |
|
||||
|
||||
`messages`数组:
|
||||
|
||||
| 项 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ------------- | ---- |
|
||||
| sender_uid | num | 发送者uid | 注意名称是sender_uid |
|
||||
| receiver_type | num | 与session_type对应 | 1为用户,2为粉丝团 |
|
||||
| receiver_id | num | 接收者uid | 注意名称是receiver_id |
|
||||
| msg_type | num | 消息类型 | 1:文字消息<br>2:图片消息<br>5:撤回的消息<br>12、13:通知 |
|
||||
| content | str | 消息内容 | 此处存在设计缺陷 |
|
||||
| msg_seqno | num | 未知 | |
|
||||
| timestamp | num | 消息发送时间戳 | |
|
||||
| at_uids | array | 未知 | |
|
||||
| msg_key | num | 未知 | |
|
||||
| msg_status | num | 消息状态 | 0 |
|
||||
| notify_code |str | 未知 | |
|
||||
| new_face_version |num | 未知 | 疑似只在粉丝团消息中出现 |
|
||||
|
||||
`e_infos`数组:
|
||||
|
||||
| 项 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ------------- | ---- |
|
||||
| text | str | 表情名称 | |
|
||||
| uri | str | 表情链接 | |
|
||||
| size | num | 表情尺寸 | 1 |
|
||||
|
||||
**示例:**
|
||||
|
||||
获取与目标用户`mid=123`私信记录:
|
||||
|
||||
```shell
|
||||
curl 'https://api.vc.bilibili.com/svr_sync/v1/svr_sync/fetch_session_msgs?sender_device_id=1&talker_id=123&session_type=1&size=20&build=0&mobi_app=web' \
|
||||
-b 'SESSDATA=xxx'
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>查看响应示例:</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "0",
|
||||
"message": "0",
|
||||
"ttl": 1,
|
||||
"data": {
|
||||
"messages": [
|
||||
{
|
||||
"sender_uid": 2239814,
|
||||
"receiver_type": 1,
|
||||
"receiver_id": 123,
|
||||
"msg_type": 1,
|
||||
"content": "{\"content\":\"[口罩]\"}",
|
||||
"msg_seqno": 309675413389322,
|
||||
"timestamp": 1654154093,
|
||||
"at_uids": [
|
||||
0
|
||||
],
|
||||
"msg_key": 7104537732714964358,
|
||||
"msg_status": 0,
|
||||
"notify_code": "",
|
||||
"new_face_version": 1
|
||||
},
|
||||
{
|
||||
"sender_uid": 2239814,
|
||||
"receiver_type": 1,
|
||||
"receiver_id": 123,
|
||||
"msg_type": 5,
|
||||
"content": "{\"content\":\"1\"}",
|
||||
"msg_seqno": 308302399586307,
|
||||
"timestamp": 1654072255,
|
||||
"at_uids": [
|
||||
0
|
||||
],
|
||||
"msg_key": 7104186240789226795,
|
||||
"msg_status": 0,
|
||||
"notify_code": ""
|
||||
},
|
||||
],
|
||||
"has_more": 0,
|
||||
"min_seqno": 308188515844097,
|
||||
"max_seqno": 309675413389322,
|
||||
"e_infos": [
|
||||
{
|
||||
"text": "[口罩]",
|
||||
"url": "http://i0.hdslb.com/bfs/emote/3ad2f66b151496d2a5fb0a8ea75f32265d778dd3.png",
|
||||
"size": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user