Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Question】关于游戏数据获取请求跑通流程 #15

Closed
BTMuli opened this issue May 5, 2023 · 6 comments
Closed

【Question】关于游戏数据获取请求跑通流程 #15

BTMuli opened this issue May 5, 2023 · 6 comments
Assignees
Labels
Question Further information is requested 新特性 New feature or request
Milestone

Comments

@BTMuli
Copy link
Owner

BTMuli commented May 5, 2023

借鉴了一些类似项目的请求写法,试着自己写了一下,结果发现返回的是 invalid request

不清楚是哪里出了问题,涉及到 DS 算法的部分都跑不通,根据 login_ticket 获取 stoken 的部分倒是没问题

有没有哪个有经验的指导一下

@BTMuli BTMuli added 新特性 New feature or request help wanted PR Welcome Good for newcomers Question Further information is requested 计划中 Something will be done labels May 5, 2023
@BTMuli BTMuli added this to the AlphaTarget milestone May 5, 2023
@BTMuli BTMuli self-assigned this May 5, 2023
@BTMuli BTMuli pinned this issue May 5, 2023
@BTMuli
Copy link
Owner Author

BTMuli commented May 5, 2023

当前提交:d959ab4

目前流程是这样的:

  1. 在通行证页面获取 cookie,保存到数据库
  2. 根据 cookie.login_ticket 获取 stokenltoken,到这边还是没问题的
  3. 根据 cookiequery 获取到 ds 跟对应的请求头

关于 DS 算法:

https://github.com/BTMuli/Tauri.Genshin/blob/d959ab44f5d9876c2de5ed86f800c415c64f8dc4/src/core/utils/getDS.ts#L1-L32

关于请求头获取:

https://github.com/BTMuli/Tauri.Genshin/blob/d959ab44f5d9876c2de5ed86f800c415c64f8dc4/src/core/utils/getRequestHeader.ts#L1-L31

  1. 发起请求

这边放一个基本的数据获取请求,其他请求也差不多是这个流程

https://github.com/BTMuli/Tauri.Genshin/blob/d959ab44f5d9876c2de5ed86f800c415c64f8dc4/src/core/request/getGameData.ts#L39-L63

@BTMuli
Copy link
Owner Author

BTMuli commented May 5, 2023

明天拿类似架构的 gs-helper 源码看一下,今天先这样吧😌

@BTMuli
Copy link
Owner Author

BTMuli commented May 17, 2023

BTMuli/TGAssistant@938e037 完成 stoken → ltoken
BTMuli/TGAssistant@f1c3151 完成 stoken → cookie_token

算上之前项目已经实现 login_ticket & login_uid → stoken&ltoken

获取请求前置的 token 获取的差不多了已经

@BTMuli BTMuli unpinned this issue May 18, 2023
@BTMuli
Copy link
Owner Author

BTMuli commented May 19, 2023

BTMuli/TGAssistant@938e037 完成 stoken → ltoken
BTMuli/TGAssistant@f1c3151 完成 stoken → cookie_token

stoken_v2对应ck加mid,stoken对应ck加stuid

@BTMuli
Copy link
Owner Author

BTMuli commented May 19, 2023

草,是我傻了,ds 算法测试我还没写,拿别人跑通的 ds 测一下就行了

@BTMuli
Copy link
Owner Author

BTMuli commented May 20, 2023

测试在 项目子模块test/http 进行,此 Issue 关闭。

@BTMuli BTMuli closed this as completed May 20, 2023
@BTMuli BTMuli removed the 计划中 Something will be done label Oct 18, 2023
@BTMuli BTMuli removed the PR Welcome Good for newcomers label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested 新特性 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant