270 lines
7.4 KiB
Markdown
270 lines
7.4 KiB
Markdown
# 登录记录
|
||
|
||
## 查询登录记录
|
||
|
||
> https://api.bilibili.com/x/safecenter/login_notice
|
||
|
||
*请求方式:GET*
|
||
|
||
认证方式:Cookie(SESSDATA)
|
||
|
||
**url参数:**
|
||
|
||
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
||
| ------ | ---- | ---------- | ------ | ------------------------------------------------------------ |
|
||
| mid | num | 用户mid | 必要 | 必须为自己的mid |
|
||
| buvid | str | 设备虚拟id | 非必要 | web端为操作登录接口时Cookie中的`buvid3`<br />若登录设备无`buvid`则留空 |
|
||
|
||
**json回复:**
|
||
|
||
根对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| ------- | ---- | -------- | --------------------------- |
|
||
| code | num | 返回值 | 0:成功<br />-101:账号未登录<br />-400:请求错误<br />-403:访问权限不足 |
|
||
| 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>
|
||
|
||
## 最近一周的登录情况
|
||
|
||
> https://api.bilibili.com/x/member/web/login/log
|
||
|
||
*请求方式: GET*
|
||
|
||
认证方式: Cookie (SESSDATA)
|
||
|
||
**URL参数:**
|
||
|
||
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
|
||
| ------ | ---- | ---------- | ------ | -------- |
|
||
| jsonp | str | 回调函数名? | 非必要 | 默认 jsonp |
|
||
| web_location | str | 网页位置? | 非必要 | 默认 333.33 |
|
||
|
||
**JSON回复:**
|
||
|
||
根对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| ------- | ---- | -------- | --------- |
|
||
| code | num | 返回值 | 0:成功<br />-101:账号未登录 |
|
||
| message | str | 错误信息 | 默认为 0 |
|
||
| ttl | num | 1 | |
|
||
| data | obj | 信息本体 | |
|
||
|
||
`data`对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| -------- | ---- | ------------ | ----- |
|
||
| count | num | 记录总数 | |
|
||
| list | arr | 登录记录列表 | |
|
||
|
||
`data`中的`list`数组:
|
||
|
||
| 项 | 类型 | 内容 | 备注 |
|
||
| ---- | ---- | -------------- | ---- |
|
||
| 0 | obj | 登录记录1 | |
|
||
| …… | obj | …… | |
|
||
| n | obj | 登录记录(n+1) | |
|
||
|
||
`list`数组中的对象:
|
||
|
||
| 字段 | 类型 | 内容 | 备注 |
|
||
| -------- | ---- | -------------- | ---- |
|
||
| ip | str | 登录 IP | IPv4:末 2 位以 `*` 打码<br />IPv6:末 5 位以 `*` 打码 |
|
||
| time | num | 登录时间 | UNIX 秒级时间戳 |
|
||
| time_at | str | 登录时间 | 格式为 `yyyy-MM-dd HH:mm:ss` |
|
||
| status | bool | 是否登录成功? | |
|
||
| type | num | 登录方式? | |
|
||
| geo | str | 登录地理位置 | |
|
||
|
||
**示例:**
|
||
|
||
查询本用户最近一周的登录情况
|
||
|
||
```shell
|
||
curl -G "https://api.bilibili.com/x/member/web/login/log" \
|
||
-b "SESSDATA=xxx"
|
||
```
|
||
|
||
<details>
|
||
<summary>查看响应示例:</summary>
|
||
|
||
```json
|
||
{
|
||
"code": 0,
|
||
"message": "0",
|
||
"ttl": 1,
|
||
"data": {
|
||
"count": 15,
|
||
"list": [
|
||
{
|
||
"ip": "240e:*:*:*:*:*:*:*",
|
||
"time": 1746038055,
|
||
"time_at": "2025-05-01 02:34:15",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国广西梧州电信"
|
||
},
|
||
{
|
||
"ip": "108.181.*.*",
|
||
"time": 1722036741,
|
||
"time_at": "2024-07-27 07:32:21",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "美国加利福尼亚州洛杉矶telus.com"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1722040653,
|
||
"time_at": "2024-07-27 08:37:33",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "巴西"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721950332,
|
||
"time_at": "2024-07-26 07:32:12",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "新加坡cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721964627,
|
||
"time_at": "2024-07-26 11:30:27",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "美国弗吉尼亚州雷斯顿cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "143.92.*.*",
|
||
"time": 1721861861,
|
||
"time_at": "2024-07-25 06:57:41",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区"
|
||
},
|
||
{
|
||
"ip": "143.92.*.*",
|
||
"time": 1721861855,
|
||
"time_at": "2024-07-25 06:57:35",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721709514,
|
||
"time_at": "2024-07-23 12:38:34",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "日本千叶县成田市cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721709618,
|
||
"time_at": "2024-07-23 12:40:18",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "日本千叶县成田市cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "143.92.*.*",
|
||
"time": 1721636125,
|
||
"time_at": "2024-07-22 16:15:25",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区"
|
||
},
|
||
{
|
||
"ip": "143.92.*.*",
|
||
"time": 1721636111,
|
||
"time_at": "2024-07-22 16:15:11",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721539870,
|
||
"time_at": "2024-07-21 13:31:10",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "美国加利福尼亚州东洛杉矶cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "104.28.*.*",
|
||
"time": 1721539965,
|
||
"time_at": "2024-07-21 13:32:45",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "美国加利福尼亚州东洛杉矶cloudflare.com"
|
||
},
|
||
{
|
||
"ip": "42.2.*.*",
|
||
"time": 1721477962,
|
||
"time_at": "2024-07-20 20:19:22",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区pccw.com"
|
||
},
|
||
{
|
||
"ip": "42.2.*.*",
|
||
"time": 1721477960,
|
||
"time_at": "2024-07-20 20:19:20",
|
||
"status": true,
|
||
"type": 0,
|
||
"geo": "中国香港特别行政区pccw.com"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
</details>
|