init 标题服务器组件 aimedb 组件
This commit is contained in:
1 parent
8d761e5e5a
commit
64fc2a5e2a
7 files changed
+254
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import httpx
|
||||
import zlib
|
||||
import json
|
||||
|
||||
from .cipher import ApiHashEncode, aes
|
||||
|
||||
from config import MaiEncoding, Endpoint
|
||||
|
||||
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
|
||||
Reference in new issue
Block a user