bilibili-API-collect/docs/login/login_notice.md
2023-02-23 11:48:58 +08:00

71 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 登录记录
## 查询登录记录
> https://api.bilibili.com/x/safecenter/login_notice
*请求方式GET*
认证方式CookieSESSDATA
**url参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | ---------- | ------ | ------------------------------------------------------------ |
| mid | num | 用户mid | 必要 | |
| buvid | str | 设备虚拟id | 非必要 | web端为操作登录接口时Cookie中的`buvid3`<br />若登录设备无`buvid`则留空 |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | --------------------------- |
| code | num | 返回值 | 0成功<br />-101账号未登录<br />-400请求错误 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----------- | ---- | ----------- | -------------------------- |
| mid | num | 登录用户mid | |
| device_name | str | 登录设备 | 依靠操作登录接口时的UA决定 |
| login_type | str | 登录方式 | 根据登录接口决定 |
| login_time | str | 登录时间 | YYYY-MM-DD hh:mm:ss |
| location | str | 登录位置 | 依靠ip决定 |
| ip | str | 登录ip | 部分用`*`打码 |
**示例:**
查询用户`293793435`设备id为`fuck_chenrui`的登录记录
```shell
curl -G 'https://api.bilibili.com/x/safecenter/login_notice' \
--data-urlencode 'mid=293793435' \
--data-urlencode 'buvid=fuck_chenrui' \
-b 'SESSDATA=xxx'
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"mid": 293793435,
"device_name": "Chrome浏览器",
"login_type": "扫码登录",
"login_time": "2020-10-02 22:42:38",
"location": "中国陕西渭南",
"ip": "36.40.***.**"
}
}
```
</details>