add GetUserMusicApi & fix wrong in payload & add type args in UserLogoutApi & update README.md
This commit is contained in:
1 parent
7139bd0951
commit
400413df45
4 files changed
+158
-15
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import argparse
|
||||
import json
|
||||
|
||||
from src.title import TitleCookie
|
||||
from src import payload
|
||||
|
||||
def GetUserMusicApi(userId, musicId, cookie):
|
||||
|
||||
data = payload.GetUserMusic(userId, musicId)
|
||||
|
||||
res = TitleCookie(userId, "GetUserMusicApi", data, cookie)
|
||||
|
||||
return res
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Title GetUserMusicApi")
|
||||
|
||||
parser.add_argument("--userId", type=int, required=True, help="userId")
|
||||
parser.add_argument("--musicId", type=int, required=True, help="musicId")
|
||||
parser.add_argument("--cookie", type=str, required=True, help="cookie")
|
||||
|
||||
args = parser.parse_args()
|
||||
print(GetUserMusicApi(args.userId, args.musicId, json.loads(args.cookie)))
|
||||
@@ -1,3 +1,90 @@
|
||||
# Kou
|
||||
|
||||
SDGA
|
||||
A Python 3 based「maimai DX International」title server interaction emulator. Inspired by Fragrance/eaquira.
|
||||
|
||||
`SteamingAssets` dumped from .app file is required. Place it in the root of the project.
|
||||
|
||||
## Usage
|
||||
|
||||
Currently, Mifare AiME is the only supported type.
|
||||
|
||||
### `UserLoginApi`
|
||||
|
||||
#### Parameters & Returns
|
||||
|
||||
| Parameter | Type | Required |
|
||||
| :--- | :--- | :--- |
|
||||
| `--userId` | `int` | Yes |
|
||||
| `--accessCode` | `str` | Yes |
|
||||
| `--serial` | `str` | Yes |
|
||||
| `--loginDateTime` | `int` | Yes |
|
||||
|
||||
Returns a two-element list containing ```[ResponseBodyFromTitleServer, CookiesFromTitleServer]```, both are string.
|
||||
|
||||
#### Example
|
||||
|
||||
```bash
|
||||
python3 UserLogin.py \
|
||||
--userId 6964139 \
|
||||
--accessCode "01036000000000000000" \
|
||||
--serial "00000000" \
|
||||
--loginDateTime 1700000000
|
||||
```
|
||||
```
|
||||
[
|
||||
'{"returnCode":1,"lastLoginDate":"2026-11-21 11:09:25","loginCount":125,"consecutiveLoginCount":3,"loginId":7710449444398826983}',
|
||||
'{"JSESSIONID": "85F1E8EABB944B94CB581BA05EC6A312"}'
|
||||
]
|
||||
```
|
||||
---
|
||||
|
||||
### `UserLogoutApi`
|
||||
|
||||
#### Parameters & Returns
|
||||
|
||||
| Parameter | Type | Required |
|
||||
| :--- | :--- | :--- |
|
||||
| `--userId` | `int` | Yes |
|
||||
| `--accessCode` | `str` | Yes |
|
||||
| `--logoutType` | `int` | Version-dependent |
|
||||
| `--loginDateTime` | `int` | Yes |
|
||||
| `--cookie` | `str` | Yes |
|
||||
|
||||
Returns a string. Just the response from Title Server.
|
||||
|
||||
#### Example
|
||||
|
||||
```bash
|
||||
python3 UserLogoutApi.py \
|
||||
--userId 6964139 \
|
||||
--accessCode "01036000000000000000" \
|
||||
--logoutType 1 \
|
||||
--loginDateTime 1700000000 \
|
||||
--cookie '{"JSESSIONID":"TRGISALEAKER"}'
|
||||
```
|
||||
```
|
||||
{'returnCode': 1}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. `GetUserDataApi` / `GetUserChargeApi` / `GetUserExtendApi` / `GetUserMissionDataApi` / `GetUserOptionApi` / `GetUserRatingApi`
|
||||
|
||||
These scripts share the same parameter signature, requiring only `--userId` and `--cookie`.
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Notes |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `--userId` | `int` | Yes | - |
|
||||
| `--cookie` | `str` | Yes | JSON string |
|
||||
|
||||
Returns a string. Just the response from Title Server.
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
python3 GetUserData.py \
|
||||
--userId 6964139 \
|
||||
--cookie '{"JSESSIONID": "TRGISALEAKER"}'
|
||||
```
|
||||
+3
-2
@@ -4,9 +4,9 @@ import json
|
||||
from src.title import TitleCookie
|
||||
from src import payload
|
||||
|
||||
def UserLogoutApi(userId, accessCode, loginDateTime, cookie):
|
||||
def UserLogoutApi(userId, accessCode, loginDateTime, logoutType, cookie):
|
||||
|
||||
data = payload.UserLogout(userId, accessCode, loginDateTime)
|
||||
data = payload.UserLogout(userId, accessCode, loginDateTime, logoutType)
|
||||
|
||||
res = TitleCookie(userId, "UserLogoutApi", data, cookie)
|
||||
|
||||
@@ -17,6 +17,7 @@ if __name__ == "__main__":
|
||||
|
||||
parser.add_argument("--userId", type=int, required=True, help="userId")
|
||||
parser.add_argument("--accessCode", type=str, required=True, help="AiME Access Code")
|
||||
parser.add_argument("--logoutType", type=int, required=True, help="登出的方法 1 或 4")
|
||||
parser.add_argument("--loginDateTime", type=int, required=True, help="时间戳")
|
||||
parser.add_argument("--cookie", type=str, required=True, help="cookie")
|
||||
|
||||
|
||||
+44
-12
@@ -6,6 +6,8 @@ from config import *
|
||||
from .loader import MusicDetail
|
||||
from .cipher import CalcRandom
|
||||
|
||||
from GetUserMusicApi import GetUserMusicApi
|
||||
|
||||
def GetUserPreview(userId):
|
||||
|
||||
data = {
|
||||
@@ -32,7 +34,7 @@ def UserLogin(userId, accessCode, loginDateTime):
|
||||
|
||||
return data
|
||||
|
||||
def UserLogout(userId, accessCode, loginDateTime):
|
||||
def UserLogout(userId, accessCode, loginDateTime, logoutType):
|
||||
|
||||
data = {
|
||||
"userId": userId,
|
||||
@@ -41,7 +43,7 @@ def UserLogout(userId, accessCode, loginDateTime):
|
||||
"placeId": placeId,
|
||||
"clientId": clientId,
|
||||
"loginDateTime": loginDateTime,
|
||||
"type": 1
|
||||
"type": logoutType
|
||||
}
|
||||
return data
|
||||
|
||||
@@ -61,6 +63,14 @@ def GetUserFavoriteItem(userId, kind):
|
||||
}
|
||||
return data
|
||||
|
||||
def GetUserMusic(userId, musicId):
|
||||
data = {
|
||||
"userId": userId,
|
||||
"nextIndex": musicId,
|
||||
"maxCount": 1
|
||||
}
|
||||
return data
|
||||
|
||||
def scoreRank(achievement):
|
||||
if achievement >= 1005000:
|
||||
return 13
|
||||
@@ -91,6 +101,28 @@ def scoreRank(achievement):
|
||||
else:
|
||||
return 0
|
||||
|
||||
def isNewMusicDetailList(userMusicList):
|
||||
|
||||
user_music_list = userMusicList.get("userMusicList") or []
|
||||
if not user_music_list:
|
||||
return 1
|
||||
|
||||
detail_list = user_music_list[0].get("userMusicDetailList") or []
|
||||
if not detail_list:
|
||||
return 1
|
||||
|
||||
# 1. 先核对第一条(或整体)的 musicId 是否与传入的 musicId 相等
|
||||
if detail_list[0].get("musicId") != musicId:
|
||||
return 1
|
||||
|
||||
# 2. 遍历 list,查找是否存在目标 level(0~4)
|
||||
for item in detail_list:
|
||||
if item.get("musicId") == musicId and item.get("level") == level:
|
||||
return 0
|
||||
|
||||
# 有该 musicId 的数据(或其他 level),但没有目标 level
|
||||
return 1
|
||||
|
||||
def UserPlaylogList(loginId, musicId, level, achievement, deluxscore, comboStatus, syncStatus, userData):
|
||||
|
||||
MusicData = MusicDetail(musicId, level)
|
||||
@@ -184,8 +216,8 @@ def UserPlaylogList(loginId, musicId, level, achievement, deluxscore, comboStatu
|
||||
"lateCount": 0,
|
||||
"isAchieveNewRecord": True,
|
||||
"isDeluxscoreNewRecord": True,
|
||||
"comboStatus": userData['userData']['playerRating'],
|
||||
"syncStatus": userData['userData']['playerRating'],
|
||||
"comboStatus": comboStatus,
|
||||
"syncStatus": syncStatus,
|
||||
"isClear": True if achievement > 800000 else False,
|
||||
"beforeRating": userData['userData']['playerRating'],
|
||||
"afterRating": userData['userData']['playerRating'],
|
||||
@@ -209,7 +241,7 @@ def UserPlaylogList(loginId, musicId, level, achievement, deluxscore, comboStatu
|
||||
}
|
||||
return data
|
||||
|
||||
def UpsertUserAllApi(userId, accessCode, loginId, musicId, level, achievement, deluxscore, comboStatus, syncStatus, loginDateTime, userActivity, userChargeList, userData, userExtend, userMissionData, userOption, userRating):
|
||||
def UpsertUserAllApi(userId, accessCode, loginId, musicId, level, achievement, deluxscore, comboStatus, syncStatus, loginDateTime, userActivity, userChargeList, userData, userExtend, userMissionData, userMusicList, userOption, userRating):
|
||||
|
||||
data = {
|
||||
"userId": userId,
|
||||
@@ -319,12 +351,12 @@ def UpsertUserAllApi(userId, accessCode, loginId, musicId, level, achievement, d
|
||||
{
|
||||
"musicId": musicId,
|
||||
"level": level,
|
||||
"playCount": 1,
|
||||
"achievement": 0,
|
||||
"comboStatus": 0,
|
||||
"syncStatus": 0,
|
||||
"deluxscoreMax": 0,
|
||||
"scoreRank": 0,
|
||||
"playCount": 1, # how can we read from userMusicList?
|
||||
"achievement": achievement,
|
||||
"comboStatus": comboStatus,
|
||||
"syncStatus": syncStatus,
|
||||
"deluxscoreMax": deluxscore,
|
||||
"scoreRank": scoreRank(achievement),
|
||||
"extNum1": 0
|
||||
}
|
||||
],
|
||||
@@ -397,7 +429,7 @@ def UpsertUserAllApi(userId, accessCode, loginId, musicId, level, achievement, d
|
||||
"isNewMapList": "", # 同上,原始数据0因为跑了个图
|
||||
"isNewLoginBonusList": "",
|
||||
"isNewItemList": "",
|
||||
"isNewMusicDetailList": "0", # 0 是修改数据库数据 1 是 insert 新数据
|
||||
"isNewMusicDetailList": isNewMusicDetailList(userMusicList), # 0 是修改数据库数据 1 是 insert 新数据
|
||||
"isNewCourseList": "",
|
||||
"isNewFavoriteList": "", # wdf?
|
||||
"isNewFriendSeasonRankingList": "",
|
||||
|
||||
Reference in new issue
Block a user