add cookie & a few apis

This commit is contained in:
Nofated095 committed 2026-11-21 04:02:33 +08:00
1 parent 64fc2a5e2a
commit 7139bd0951
15 files changed
+836 -38

No files matched your search

+31 -2
View File
@@ -6,7 +6,7 @@ from .cipher import ApiHashEncode, aes
from config import MaiEncoding, Endpoint
def Title(userId: int, ApiType: str, data: dict):
def TitleCookie(userId: int, ApiType: str, data: dict, cookie: dict):
ApiTypeHash = ApiHashEncode(ApiType)
@@ -27,10 +27,39 @@ def Title(userId: int, ApiType: str, data: dict):
f"https://{Endpoint}/Maimai2Servlet/{ApiTypeHash}",
headers = headers,
data = AESEncrptedData,
cookies = cookie,
verify = True
)
CompressedData = aes.decrypt(TitleResponse.content)
data = zlib.decompress(CompressedData).decode('utf-8')
return data
return data
def Title(userId: int, ApiType: str, data: dict):
ApiTypeHash = ApiHashEncode(ApiType)
headers = {
"User-Agent": f"{ApiTypeHash}#{userId}",
"Content-Type": "application/json",
"Mai-Encoding": MaiEncoding,
"Accept-Encoding": "",
"Charset": "UTF-8",
"Content-Encoding": "deflate"
}
data = bytes(json.dumps(data, ensure_ascii=False), encoding="utf-8")
CompressedData = zlib.compress(data)
AESEncrptedData = aes.encrypt(CompressedData)
TitleResponse = httpx.post(
f"https://{Endpoint}/Maimai2Servlet/{ApiTypeHash}",
headers = headers,
data = AESEncrptedData,
verify = True
)
CompressedData = aes.decrypt(TitleResponse.content)
data = zlib.decompress(CompressedData).decode('utf-8')
return [data, dict(TitleResponse.cookies)]