From 1eba8453a5cf1a679bb110796a260ba0feae1265 Mon Sep 17 00:00:00 2001 From: mokurin000 <1348292515a@gmail.com> Date: Sun, 3 Aug 2025 18:42:24 +0800 Subject: [PATCH] feat: example api endpoints --- GetAny.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/GetAny.py b/GetAny.py index 4a21041..31a0d98 100644 --- a/GetAny.py +++ b/GetAny.py @@ -1,5 +1,6 @@ # 获取用户简略预览数据的 API 实现,此 API 无需任何登录即可调取 +from loguru import logger import rapidjson as json from API_TitleServer import apiSDGB @@ -20,5 +21,11 @@ if __name__ == "__main__": # userId = testUid8 # print(apiGetAny(userId, "GetUserRatingApi")) # print(apiGetAny(userId, "GetUserPreviewApi")) - print(apiGetAny(userId, "GetUserCourseApi")) - print(apiGetAny(userId, "GetUserExtendApi")) + + for type in ["course", "extend", "character", "activity", "charge", "option", "region"]: + try: + data = apiGetAny(userId, f"GetUser{type.title()}Api", noLog=True) + except Exception as e: + logger.error(f"failed when scraping {type}: {e}") + else: + print(f"{type}:", json.dumps(json.loads(data), ensure_ascii=False, indent=4))