继续修改文档格式 补完TV端扫码登录

This commit is contained in:
SocialSisterYi
2020-07-18 23:56:10 +08:00
parent b8035da959
commit 57e130070f
36 changed files with 1158 additions and 386 deletions

View File

@@ -1,6 +1,6 @@
# 二维码登录
流程&逻辑:
web端流程&逻辑:
1. 获取`二维码内容url`以及`密钥`,以`二维码内容url`生成二维码,等待手机客户端扫描
2.`密钥`作为参数进行POST
@@ -9,6 +9,12 @@
5. if "data"==-5 goto 3 && 提示`已扫描`else goto 1&提示`二维码超时或错误`(密钥是否有效)
6. 成功后会自动配置cookie 如需登录游戏分站则访问`data`.`url`中的url
TV端流程&逻辑:
1. 获取`二维码内容url`以及`密钥`,以`二维码内容url`生成二维码,等待手机客户端扫描
2.`密钥`作为参数进行POST
3.
<img src="/imgs/2233login.png"/>
@@ -97,11 +103,11 @@ data 对象:
**示例:**
例如扫码秘钥`23333`
使用扫描秘钥`c3bd5286a2b40a822f5f60e9bf3f602e`登录
```shell
curl "http://passport.bilibili.com/qrcode/getLoginInfo"\
--data-urlencode 'oauthKey=23333'\
--data-urlencode 'oauthKey=c3bd5286a2b40a822f5f60e9bf3f602e'\
-c 'cookie.txt'
```
@@ -177,8 +183,6 @@ bili_jct=(csrf)&
gourl=(跳转网址 默认为主页)
## 申请二维码URL及扫码密钥TV端
> http://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code
@@ -189,25 +193,27 @@ gourl=(跳转网址 默认为主页)
密钥超时为180秒
本接口可申请用于APP方式登录的`access_key`
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| -------- | ---- | ---------- | ----------- | ----- |
| appkey | str | APP密钥 | APP方式必要 | |
| local_id | str | TV端ID | APP方式必要 | 可为0 |
| ts | num | 当前时间戳 | APP方式必要 | |
| sign | str | APP签名 | APP方式必要 | |
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| -------- | ---- | ---------- | ----------- | ------------------------ |
| appkey | str | APP密钥 | APP方式必要 | 仅可用`4409e2ce8ffd12b8` |
| local_id | str | TV端ID | TV端必要 | 可为0 |
| ts | num | 当前时间戳 | APP方式必要 | |
| sign | str | APP签名 | APP方式必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------- |
| code | num | 返回值 | 0成功 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ---------------------------------------------------- |
| code | num | 返回值 | 0成功<br />-3API校验密匙错误<br />-400请求错误 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象:
@@ -218,3 +224,92 @@ gourl=(跳转网址 默认为主页)
**示例:**
```shell
curl 'http://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code'\
--data-urlencode 'appkey=4409e2ce8ffd12b8'\
--data-urlencode 'local_id=0'\
--data-urlencode 'ts=0'\
--data-urlencode 'sign=e134154ed6add881d28fbdf68653cd9c'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"url": "https://passport.bilibili.com/x/passport-tv-login/h5/qrcode/auth?auth_code=0eeb635a64526709d70cb4c854a3b001",
"auth_code": "0eeb635a64526709d70cb4c854a3b001"
}
}
```
## 使用扫码登录TV端
> http://passport.bilibili.com/x/passport-tv-login/qrcode/poll
*请求方式POST*
鉴权方式appkey
密钥超时为180秒
验证登录成功后会返回可用于APP方式登录的`access_key`以及`refresh_token`
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| --------- | ---- | ---------- | ----------- | ------------------------ |
| appkey | str | APP密钥 | APP方式必要 | 仅可用`4409e2ce8ffd12b8` |
| auth_code | str | 扫码秘钥 | 必要 | |
| local_id | str | TV端ID | TV端必要 | 可为0 |
| ts | num | 当前时间戳 | APP方式必要 | |
| sign | str | APP签名 | APP方式必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ----------------------------- | -------- | ------------------------------------------------------------ |
| code | num | 返回值 | 0成功<br />-3API校验密匙错误<br />-400请求错误<br />86038二维码已失效<br />86039二维码尚未确认 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | 有效时obj<br />无效时null | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------- | ---- | ------------ | -------------------- |
| mid | num | 登录用户UID | |
| access_token | str | APP登录Token | |
| refresh_token | str | APP刷新Token | |
| expires_in | num | 有效时间 | 单位为秒 一般为30天 |
**示例:**
使用扫描秘钥`6214464b3025541abf6f654cf7569a01`进行验证登录
```shell
curl 'http://passport.bilibili.com/x/passport-tv-login/qrcode/poll'\
--data-urlencode 'appkey=4409e2ce8ffd12b8'\
--data-urlencode 'auth_code=6214464b3025541abf6f654cf7569a01'\
--data-urlencode 'local_id=0'\
--data-urlencode 'ts=0'\
--data-urlencode 'sign=87de3d0fee7c3f4facd244537238914e'\
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"mid": 293793435,
"access_token": "***",
"refresh_token": "***",
"expires_in": 2592000
}
}
```

View File

@@ -84,8 +84,6 @@ curl 'http://passport.bilibili.com/web/generic/country/list'
}
```
## 发送短信验证码web端
> http://passport.bilibili.com/web/sms/general/v2/send

View File

@@ -1,15 +1,17 @@
# 登录基本信息
**本页所有操作均需登录(SESSDATA**
**本页所有操作均需登录(Cookie或APP**
## 登录用户信息1完整
## 登录用户信息1web端
> http://api.bilibili.com/nav (带有转义)
> http://api.bilibili.com/nav带有转义
>
> http://api.bilibili.com/x/web-interface/nav (原始数据)
> http://api.bilibili.com/x/web-interface/nav原始数据
*请求方式GET*
认证方式仅可CookieSESSDATA
**json回复**
根对象:
@@ -105,83 +107,86 @@
**示例:**
查询当前登录用户的信息
http://api.bilibili.com/x/web-interface/nav
```shell
curl 'http://api.bilibili.com/nav'\
-b 'SESSDATA=xxx'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"isLogin": true,
"email_verified": 1,
"face": "http://i1.hdslb.com/bfs/face/aebb2639a0d47f2ce1fec0631f412eaf53d4a0be.jpg",
"level_info": {
"current_level": 5,
"current_min": 10800,
"current_exp": 16269,
"next_exp": 28800
"code":0,
"message":"0",
"ttl":1,
"data":{
"isLogin":true,
"email_verified":1,
"face":"http://i1.hdslb.com/bfs/face/aebb2639a0d47f2ce1fec0631f412eaf53d4a0be.jpg",
"level_info":{
"current_level":5,
"current_min":10800,
"current_exp":17065,
"next_exp":28800
},
"mid": 293793435,
"mobile_verified": 1,
"money": 26.6,
"moral": 70,
"official": {
"role": 0,
"title": "",
"desc": "",
"type": -1
"mid":293793435,
"mobile_verified":1,
"money":33.4,
"moral":70,
"official":{
"role":0,
"title":"",
"desc":"",
"type":-1
},
"officialVerify": {
"type": -1,
"desc": ""
"officialVerify":{
"type":-1,
"desc":""
},
"pendant": {
"pid": 1888,
"name": "泠鸢yousa",
"image": "http://i0.hdslb.com/bfs/garb/item/3e66e712b8e70c6b02393c54ad5fd8d993eb39f9.png",
"expire": 0,
"image_enhance": "http://i0.hdslb.com/bfs/garb/item/3e66e712b8e70c6b02393c54ad5fd8d993eb39f9.png"
"pendant":{
"pid":0,
"name":"",
"image":"",
"expire":0,
"image_enhance":""
},
"scores": 0,
"uname": "社会易姐QwQ",
"vipDueDate": 1612454400000,
"vipStatus": 1,
"vipType": 2,
"vip_pay_type": 1,
"vip_theme_type": 0,
"vip_label": {
"path": "",
"text": "年度大会员",
"label_theme": "annual_vip"
"scores":0,
"uname":"社会易姐QwQ",
"vipDueDate":1612454400000,
"vipStatus":1,
"vipType":2,
"vip_pay_type":1,
"vip_theme_type":0,
"vip_label":{
"path":"",
"text":"年度大会员",
"label_theme":"annual_vip"
},
"vip_avatar_subscript": 1,
"vip_nickname_color": "#FB7299",
"wallet": {
"mid": 293793435,
"bcoin_balance": 8,
"coupon_balance": 5,
"coupon_due_time": 0
"vip_avatar_subscript":1,
"vip_nickname_color":"#FB7299",
"wallet":{
"mid":293793435,
"bcoin_balance":8,
"coupon_balance":5,
"coupon_due_time":0
},
"has_shop": false,
"shop_url": "",
"allowance_count": 0,
"answer_status": 0
"has_shop":false,
"shop_url":"",
"allowance_count":0,
"answer_status":0
}
}
```
## 登录用户信息2仅部分 带有转义)
## 登录用户信息2web端仅部分
> http://account.bilibili.com/home/userInfo
*请求方式GET*
需要验证DedeUserID存在且不为0
认证方式仅可CookieSESSDATA
鉴权方式Cookie中`DedeUserID`存在且不为0
带有转义
**json回复**
@@ -221,9 +226,10 @@ http://api.bilibili.com/x/web-interface/nav
**示例:**
查询当前登录用户的信息
http://account.bilibili.com/home/userInfo
```shell
curl 'http://account.bilibili.com/home/userInfo'\
-b 'SESSDATA=xxx;DedeUserID=1;'
```
```json
{
@@ -251,14 +257,170 @@ http://account.bilibili.com/home/userInfo
}
```
## 登录用户信息APP端
> http://app.bilibili.com/x/v2/account/myinfo
*请求方式GET*
认证方式仅可APP
鉴权方式appkey
**url参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ---------- | ---- | ------------ | ----------- | ---- |
| access_key | str | APP登录Token | APP方式必要 | |
| appkey | str | APP密钥 | APP方式必要 | |
| ts | num | 当前时间戳 | APP方式必要 | |
| sign | str | APP签名 | APP方式必要 | |
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------------------------------------------------------------ |
| code | num | 返回值 | 0成功<br />-3API校验密匙错误<br />-101账号未登录<br />-400请求错误 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | **作用尚不明确** |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| -------------- | ---- | ---------------- | ------------------------ |
| mid | num | 用户UID | |
| name | str | 用户昵称 | |
| sign | str | 用户签名 | |
| coins | num | 拥有硬币数 | |
| birthday | str | 用户生日 | YYYY-MM-DD |
| face | str | 用户头像url | |
| sex | num | 用户性别 | 1男 |
| level | num | 用户等级 | 0-6 |
| rank | num | 1000 | **作用尚不明确** |
| silence | num | 用户是否被封禁 | 0正常<br />1封禁 |
| vip | obj | 会员信息 | |
| email_status | num | 是否验证邮箱地址 | 0未验证<br />1已验证 |
| tel_status | num | 是否验证手机号 | 0未验证<br />1已验证 |
| official | obj | 认证信息 | |
| identification | num | 1 | **作用尚不明确** |
| invite | obj | | |
| is_tourist | num | 0 | **作用尚不明确** |
| pin_prompting | num | 0 | **作用尚不明确** |
`data`中的`vip`对象:
| 字段 | 类型 | 内容 | 备注 |
| ---------------- | ---- | ---------------- | ------------------------------- |
| type | num | 大会员类型 | 0<br />1月度<br />2年度 |
| status | num | 会员开通状态 | 0<br />1有 |
| due_date | num | 大会员到期时间 | 毫秒 时间戳 |
| vip_pay_type | num | 会员开通状态 | 0<br />1有 |
| theme_type | num | 会员开通状态 | 0<br />1有 |
| label | obj | 大会员信息 | |
| avatar_subscript | num | 是否显示会员图标 | 0不显示<br />1显示 |
| nickname_color | str | 会员昵称颜色 | 颜色码 |
`vip`中的`label`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----------- | ---- | ------------ | ---------------- |
| path | str | 空 | **作用尚不明确** |
| text | str | 会员类型文字 | |
| label_theme | str | 会员类型 | |
`data`中的`official`对象:
| 字段 | 类型 | 内容 | 备注 |
| ----- | ---- | -------- | ----------------------------------------------- |
| role | num | 认证类型 | 0<br />1 2个人认证<br />3 4 5 6机构认证 |
| title | str | 认证信息 | 无为空 |
| desc | str | 认证备注 | 无为空 |
| type | num | 认证备注 | 无为空 |
`data`中的`invite`对象:
| 字段 | 类型 | 内容 | 备注 |
| ------------- | ---- | ---- | ---------------- |
| invite_remind | num | 1 | **作用尚不明确** |
| display | bool | true | **作用尚不明确** |
**示例:**
```shell
curl -G 'http://app.bilibili.com/x/v2/account/myinfo'\
--data-urlencode 'access_key=xxx'\
--data-urlencode 'appkey=4409e2ce8ffd12b8'\
--data-urlencode 'ts=0'\
--data-urlencode 'sign=b8fb8480049c525994be6507a97ae0b6'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"mid": 293793435,
"name": "社会易姐QwQ",
"sign": "高中技术宅一枚爱好MC&电子&8-bit音乐&数码&编程资深猿厨粉丝群1136462265",
"coins": 33.4,
"birthday": "2002-03-05",
"face": "http://i1.hdslb.com/bfs/face/aebb2639a0d47f2ce1fec0631f412eaf53d4a0be.jpg",
"sex": 1,
"level": 5,
"rank": 10000,
"silence": 0,
"vip": {
"type": 2,
"status": 1,
"due_date": 1612454400000,
"vip_pay_type": 1,
"theme_type": 0,
"label": {
"path": "",
"text": "年度大会员",
"label_theme": "annual_vip"
},
"avatar_subscript": 1,
"nickname_color": "#FB7299"
},
"email_status": 1,
"tel_status": 1,
"official": {
"role": 0,
"title": "",
"desc": "",
"type": -1
},
"identification": 1,
"invite": {
"invite_remind": 1,
"display": true
},
"is_tourist": 0,
"pin_prompting": 0
}
}
```
## 登录用户状态数
## 登录用户状态数(双端)
> http://api.bilibili.com/x/web-interface/nav/stat
*请求方式GET*
认证方式CookieSESSDATA或APP
**url参数**
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ---------- | ---- | ------------ | ----------- | ---- |
| access_key | str | APP登录Token | APP方式必要 | |
**json回复**
根对象:
@@ -278,21 +440,45 @@ http://account.bilibili.com/home/userInfo
**示例:**
查询当前登录用户的状态数
当前登录用户的状态数为粉丝596关注754发送的动态252
粉丝数为365关注数为695发送的动态数为162
Cookie方式
http://api.bilibili.com/x/web-interface/nav/stat
```shell
curl 'http://api.bilibili.com/x/web-interface/nav/stat'\
-b 'SESSDATA=xxx'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"following": 695,
"follower": 365,
"dynamic_count": 162
}
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"following": 754,
"follower": 596,
"dynamic_count": 252
}
}
```
APP方式
```shell
curl -G 'http://api.bilibili.com/x/web-interface/nav/stat'\
--data-urlencode 'access_key=d907f51122c59599d580ade2315af971'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"following": 754,
"follower": 596,
"dynamic_count": 252
}
}
```

View File

@@ -8,6 +8,8 @@
*请求方式GET*
认证方式CookieSESSDATA
**json回复**
根对象:
@@ -34,34 +36,37 @@
**示例:**
http://api.bilibili.com/x/member/web/account
```shell
curl 'http://api.bilibili.com/x/member/web/account'\
-b 'SESSDATA=xxx'
```
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"mid": 293793435,
"uname": "社会易姐QwQ",
"userid": "bili_84675323391",
"sign": "高中技术宅一枚爱好MC&电子&音乐&数码&编程,资深猿厨",
"birthday": "2002-03-05",
"sex": "男",
"nick_free": false,
"rank": "正式会员"
"code":0,
"message":"0",
"ttl":1,
"data":{
"mid":293793435,
"uname":"社会易姐QwQ",
"userid":"bili_84675323391",
"sign":"高中技术宅一枚爱好MC&电子&8-bit音乐&数码&编程,资深猿厨粉丝群1136462265",
"birthday":"2002-03-05",
"sex":"男",
"nick_free":false,
"rank":"正式会员"
}
}
```
## 查询每日奖励状态
> http://api.bilibili.com/x/member/web/exp/reward
*请求方式GET*
认证方式CookieSESSDATA
**json回复**
根对象:
@@ -88,7 +93,10 @@ http://api.bilibili.com/x/member/web/account
**示例:**
http://api.bilibili.com/x/member/web/exp/reward
```shell
curl 'http://api.bilibili.com/x/member/web/exp/reward'\
-b 'SESSDATA=xxx'
```
```json
{
@@ -108,14 +116,14 @@ http://api.bilibili.com/x/member/web/exp/reward
}
```
## 查询大会员状态
> http://api.bilibili.com/x/vip/web/user/info
*请求方式GET*
认证方式CookieSESSDATA
**json回复**
根对象:
@@ -140,7 +148,10 @@ http://api.bilibili.com/x/member/web/exp/reward
**示例:**
http://api.bilibili.com/x/vip/web/user/info
```shell
curl 'http://api.bilibili.com/x/vip/web/user/info'\
-b 'SESSDATA=xxx'
```
```json
{
@@ -158,15 +169,15 @@ http://api.bilibili.com/x/vip/web/user/info
}
```
## 查询账号安全情况
> http://passport.bilibili.com/web/site/user/info
*请求方式GET*
需要验证`DedeUserID`存在且不为0
认证方式CookieSESSDATA
鉴权方式Cookie中`DedeUserID`存在且不为0
**json回复**
@@ -223,7 +234,10 @@ http://api.bilibili.com/x/vip/web/user/info
**示例:**
http://passport.bilibili.com/web/site/user/info
```shell
curl 'http://passport.bilibili.com/web/site/user/info'\
-b 'SESSDATA=xxx;DedeUserID=1;'
```
```json
{
@@ -254,14 +268,14 @@ http://passport.bilibili.com/web/site/user/info
}
```
## 查询账号实名认证状态
> http://api.bilibili.com/x/member/realname/status
*请求方式GET*
认证方式CookieSESSDATA
**json回复**
根对象:
@@ -281,10 +295,13 @@ http://passport.bilibili.com/web/site/user/info
**示例:**
http://api.bilibili.com/x/member/realname/status
当前状态为已认证
```shell
curl 'http://api.bilibili.com/x/member/realname/status'\
-b 'SESSDATA=xxx'
```
```json
{
"code": 0,
@@ -296,14 +313,14 @@ http://api.bilibili.com/x/member/realname/status
}
```
## 查询实名认证详细信息
> http://api.bilibili.com/x/member/realname/apply/status
*请求方式GET*
认证方式CookieSESSDATA
**json回复**
根对象:
@@ -325,7 +342,10 @@ http://api.bilibili.com/x/member/realname/status
| card | str | 证件号码 | 星号隐藏部分信息 |
| card_type | num | 证件类型代码 | 0身份证<br />2港澳居民来往内地通行证<br />3台湾居民来往大陆通行证<br />4护照(中国签发)<br />5外国人永久居留证<br />6其他国家或地区身份证明 |
http://api.bilibili.com/x/member/realname/apply/status
```shell
curl 'http://api.bilibili.com/x/member/realname/apply/status'\
-b 'SESSDATA=xxx'
```
```json
{
@@ -342,14 +362,14 @@ http://api.bilibili.com/x/member/realname/apply/status
}
```
## 查询硬币变化情况
> http://api.bilibili.com/x/member/web/coin/log
*请求方式GET*
认证方式CookieSESSDATA
仅能查询最近一周的情况
**json回复**
@@ -388,7 +408,10 @@ http://api.bilibili.com/x/member/realname/apply/status
**示例:**
http://api.bilibili.com/x/member/web/coin/log
```shell
curl 'http://api.bilibili.com/x/member/web/coin/log'\
-b 'SESSDATA=xxx'
```
```json
{
@@ -474,18 +497,16 @@ http://api.bilibili.com/x/member/web/coin/log
*请求方式POST*
签名最多支持70个字
认证方式CookieSESSDATA
修改签名不会立即生效,会等待审核队列稍后生效
需要登录(SESSDATA)
**正文参数( application/x-www-form-urlencoded **
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| --------- | ---- | ------------------------ | ------ | ---------------------- |
| user_sign | str | 要设置的签名内容 | 非必要 | 删除签名留空或省去即可 |
| csrf | str | CSRF Token位于cookie | 必要 | |
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| --------- | ---- | ------------------------ | ------ | -------------------------------------------- |
| user_sign | str | 要设置的签名内容 | 非必要 | 删除签名留空或省去即可<br />最多支持70个字符 |
| csrf | str | CSRF Token位于cookie | 必要 | |
**json回复**
@@ -499,9 +520,14 @@ http://api.bilibili.com/x/member/web/coin/log
**示例:**
更新个人标签为`高中技术宅一枚爱好MC&电子&音乐&数码&编程,资深猿厨`
更新个人标签为`高中技术宅一枚爱好MC&电子&8-bit音乐&数码&编程,资深猿厨粉丝群1136462265`
curl -b "SESSDATA=xxx" -d "user_sign=%E9%AB%98%E4%B8%AD%E6%8A%80%E6%9C%AF%E5%AE%85%E4%B8%80%E6%9E%9A%EF%BC%8C%E7%88%B1%E5%A5%BDMC&%E7%94%B5%E5%AD%90&%E9%9F%B3%E4%B9%90&%E6%95%B0%E7%A0%81&%E7%BC%96%E7%A8%8B%EF%BC%8C%E8%B5%84%E6%B7%B1%E7%8C%BF%E5%8E%A8&csrf=xxx" "http://api.bilibili.com/x/member/web/sign/update"
```shell
curl 'http://api.bilibili.com/x/member/web/sign/update'\
--data-urlencode 'user_sign=高中技术宅一枚爱好MC&电子&8-bit音乐&数码&编程资深猿厨粉丝群1136462265'\
--data-urlencode 'csrf=xxx'\
-b 'SESSDATA=xxx'
```
```json
{