From 94d9ad14f1330bca13bcb25880f6ec674fb1a1a6 Mon Sep 17 00:00:00 2001 From: Kamisato-Ayaka-233 <2627706725@qq.com> Date: Sat, 3 Jun 2023 14:49:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF=E7=A0=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB=20=E4=BF=AE=E6=94=B9API=E7=9A=84=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=A4=B4=E5=92=8CCookie=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/historical_up_items.md | 6 -- hoyolab/article/article.md | 11 ++- hoyolab/user/game_account_info.md | 37 ++++++-- hoyolab/user/info.md | 85 +++++++++++++++++-- other/authentication.md | 2 +- other/error_code.md | 19 ++++- 6 files changed, 130 insertions(+), 30 deletions(-) diff --git a/genshin_impact/thirdparty/historical_up_items.md b/genshin_impact/thirdparty/historical_up_items.md index 636b0c5..d06afab 100644 --- a/genshin_impact/thirdparty/historical_up_items.md +++ b/genshin_impact/thirdparty/historical_up_items.md @@ -10,12 +10,6 @@ _请求方式:GET_ `https://api.21cnt.cn/genshin/banner` - - **JSON返回:** 根对象: diff --git a/hoyolab/article/article.md b/hoyolab/article/article.md index e9f2b56..5abb174 100644 --- a/hoyolab/article/article.md +++ b/hoyolab/article/article.md @@ -18,7 +18,7 @@ _请求方式:GET_ | --- | ---- | ---- | ---- | | gids | num | 游戏ID | | | page | num | 页数 | 若未指定则为第1页 | -| page_size | num | 每页文章数量
1~50 | 若未指定或超出范围则为每页20篇 | +| page_size | num | 每页文章数量,范围为1-50 | 若未指定或超出范围则为每页20篇 | **JSON返回:** @@ -656,13 +656,16 @@ _请求方式:GET_ _请求方式:GET_ -`https://bbs-api.miyoushe.com/post/wapi/getPostFull` +> _需要验证请求头_ + +网页:`https://bbs-api.miyoushe.com/post/wapi/getPostFull` +应用:`https://bbs-api.miyoushe.com/post/api/getPostFull` **参数:** | 字段 | 类型 | 内容 | 备注 | | --- | ---- | ---- | ---- | - +| post_id | num | 文章ID | | **JSON返回:** @@ -670,7 +673,7 @@ _请求方式:GET_ | 字段 | 类型 | 内容 | 备注 | | --- | ---- | ---- | ---- | -| retcode | num | 返回码
1 未选择游戏 | | +| retcode | num | 返回码
1101 参数`post_id`对应的文章不存在 | | | message | str | 返回消息 | | | data | obj | 首页信息 | | diff --git a/hoyolab/user/game_account_info.md b/hoyolab/user/game_account_info.md index 578fe70..46c33ef 100644 --- a/hoyolab/user/game_account_info.md +++ b/hoyolab/user/game_account_info.md @@ -4,6 +4,7 @@ - [获取首页信息](#genshin-home) - [获取角色信息](#genshin-characters) - [获取深境螺旋信息](#genshin-spiral-abyss) + - [每日便签](#genshin-daily-note) - [获取祈愿记录](#genshin-wish) - [崩坏:星穹铁道](#崩坏星穹铁道) - [获取首页信息](#star-rail-home) @@ -24,8 +25,12 @@ _请求方式:GET_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/index` @@ -236,8 +241,12 @@ _请求方式:GET_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `https://bbs-api-os.hoyolab.com/game_record/genshin/api/index` @@ -465,8 +474,12 @@ _请求方式:POST_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `未知` @@ -483,8 +496,12 @@ _请求方式:GET_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/spiralAbyss` @@ -1779,8 +1796,12 @@ _请求方式:GET_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `未知` @@ -1901,8 +1922,12 @@ _请求方式:GET_ > _需要验证请求头_ > > `x-rpc-client_type`:`5` +> 4X`salt` +> `DS2` > -> _需要验证网页Cookie_ +> _需要验证Cookie_ +> +> LToken `https://api-takumi-record.mihoyo.com/game_record/app/hkrpg/api/index` diff --git a/hoyolab/user/info.md b/hoyolab/user/info.md index 9a73b5f..b227477 100644 --- a/hoyolab/user/info.md +++ b/hoyolab/user/info.md @@ -3,7 +3,8 @@ - [用户信息](#用户信息) - [获取用户完整信息](#获取用户完整信息) - [获取用户发布的文章](#获取用户发布的文章) - - [通过Cookie获取用户`authkey`](#通过cookie获取用户authkey) + - [通过Cookie获取用户`authkey`A](#通过cookie获取账号authkeya) + - [通过Cookie获取用户`authkey`B](#通过cookie获取账号authkeyb) --- @@ -339,20 +340,19 @@ _请求方式:GET_ | 字段 | 类型 | 内容 | 备注 | | ---- | ---- | ---- | ---- | +## 通过Cookie获取账号`authkey`A -## 通过Cookie获取用户`authkey` - -在请求例如获取用户的游戏抽卡记录等API时需要使用到`authkey`。 + **国服:** _请求方式:POST_ -> _需要验证SToken_ +> _需要验证Cookie_ +> +> SToken -`https://api-takumi.miyoushe.com/binding/api/genAuthKey` `https://api-takumi.miyoushe.com/account/auth/api/genAuthKey` -`https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/granter/login/genAuthKey` **JSON请求:** @@ -366,7 +366,7 @@ _请求方式:POST_ | 字段 | 类型 | 内容 | 备注 | | ---- | ---- | ---- | ---- | -| retcode | num | 返回码
1002 请求体的`game_biz`字段不正确
-100 Cookie不正确 | | +| retcode | num | 返回码
1002 请求体的`game_biz`字段不正确 | | | message | str | 返回消息 | | | data | obj | `authkey`信息 | | @@ -376,7 +376,74 @@ _请求方式:POST_ | ---- | ---- | ---- | ---- | | sign_type | num | 2 | | | authkey_ver | num | 1 | | -| authkey | str | `authkey` | | +| authkey | str | `authkey`A | | + +
+查看示例 + +```json +{ + "retcode": 0, + "message": "OK", + "data": { + "sign_type": 2, + "authkey_ver": 1, + "authkey": "..." + } +} +``` + +
+ +**国际服:** + +`未知` + +## 通过Cookie获取账号`authkey`B + +在请求例如获取用户的游戏抽卡记录等API时需要使用到`authkey`B。 + +**国服:** + +_请求方式:POST_ + +> _需要验证请求头_ +> +> `x-rpc-client_type`:`2` +> LK`salt` +> `DS1` +> +> _需要验证Cookie_ +> +> SToken + +`https://api-takumi.miyoushe.com/binding/api/genAuthKey` + + +**JSON请求:** + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| game_biz | str | 获取的`authkey`B的游戏
hk4e_cn 《原神》
hkrpg_cn 《崩坏:星穹铁道》
| | +| game_uid | num | 游戏 + +**JSON返回:** + +根对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| retcode | num | 返回码
1002 请求体的`game_biz`字段不正确 | | +| message | str | 返回消息 | | +| data | obj | `authkey`信息 | | + +`data`对象: + +| 字段 | 类型 | 内容 | 备注 | +| ---- | ---- | ---- | ---- | +| sign_type | num | 2 | | +| authkey_ver | num | 1 | | +| authkey | str | `authkey`B | |
查看示例 diff --git a/other/authentication.md b/other/authentication.md index 7ebef38..922ecd6 100644 --- a/other/authentication.md +++ b/other/authentication.md @@ -226,7 +226,7 @@ lettersAndNumbers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456 salt = "ZSHlXeQUBis52qD1kEgKt5lUYed4b7Bb" t = int(time.time()) -r = random.choices(lettersAndNumbers, k=6) +r = "".join(random.choices(lettersAndNumbers, k=6)) main = f"salt={salt}&t={t}&r={r}" ds = md5(main.encode(encoding='UTF-8')).hexdigest() diff --git a/other/error_code.md b/other/error_code.md index c60f91a..328f54c 100644 --- a/other/error_code.md +++ b/other/error_code.md @@ -6,9 +6,20 @@ 错误码为API返回JSON中的`retcode`字段。 +### `api-takumi-record.mihoyo.com` + | 错误码 | 消息 | 原因 | -| ------------------------------ | ---- | --- | -| -10001 | invalid request | 该API需要验证请求头,请求头的`DS`字段缺失
请查看[绕过检测与鉴权](other/authentication.md) | -| -1 | param XXX error: value must be greater than X
param XXX error: value must be in list [X ...] | 传递的参数XXX缺失
传递的参数XXX的值只能是X、...中 | +| ----- | ---- | ---- | +| -10001 | invalid request | 该API需要验证请求头,请求头的一些字段缺失或错误
请查看[绕过检测与鉴权](other/authentication.md) | +| -1 | param error
param XXX error: value must be greater than X
param XXX error: value must be in list [X ...] | 传递的参数值错误
传递的参数XXX缺失
传递的参数XXX的值只能是X、...中 | | 1008 | 用户信息不匹配 | 传递的参数不正确
(例如获取用户游戏账号信息的`role_id`为无效UID) | -| 10001 | Please login | 该API需要验证Cookie
请查看[绕过检测与鉴权](other/authentication.md#cookie) | \ No newline at end of file +| 10001 | Please login | 该API需要验证Cookie
请查看[绕过检测与鉴权](other/authentication.md#cookie) | +| 1034 | | 请求遇到验证码 | + +### `api-takumi.miyoushe.com` + +| 错误码 | 消息 | 原因 | +| ----- | ---- | ---- | +| -10001 | invalid request | 该API需要验证请求头,请求头的一些字段缺失或错误
请查看[绕过检测与鉴权](other/authentication.md) | +| -502 | Something went wrong...please retry later | 传递的参数错误 | +| -100 | 登录失效,请重新登录 | \ No newline at end of file