From 66da0fcf43e7d8e658012a18536177d6e053f881 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Fri, 29 Jul 2022 23:34:56 +0800 Subject: [PATCH] :sparkles: add `enka.network` UA --- Paimon_Info/__init__.py | 6 +++--- Paimon_Info/get_data.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Paimon_Info/__init__.py b/Paimon_Info/__init__.py index 82ee820..04feec0 100644 --- a/Paimon_Info/__init__.py +++ b/Paimon_Info/__init__.py @@ -551,10 +551,10 @@ async def _(event: MessageEvent, uid: Message = Arg('uid')): await update_info.send('派蒙开始更新信息~请稍等哦~') enka_data = await get_enka_data(uid) if not enka_data: - if uid[0] == '5' or uid[0] == '2': + if uid[0] == '5': await update_info.finish('暂不支持B服账号哦~请等待开发者更新吧~') else: - await update_info.finish('派蒙没有查到该uid的信息哦~') + await update_info.finish('派蒙没有获取到该uid的信息哦,可能是接口服务出现问题,稍候再试吧~') ud_lmt.start_cd(uid, 300) ud_lmt.start_cd(get_message_id(event), 15) player_info = PlayerInfo(uid) @@ -825,7 +825,7 @@ async def get_mys_coin_handler(event: MessageEvent, msg: Message = CommandArg()) if not cookie: await get_mys_coin.finish('你的该uid还没绑定cookie哦,先用ysb绑定吧') stoken = sk[0][4] - await get_mys_coin.send('开始执行米游社获取,请稍等哦~') + await get_mys_coin.send('开始执行米游币获取,请稍等哦~') get_coin_task = MihoyoBBSCoin(stoken) data = await get_coin_task.task_run() msg = "米游币获取完成\n" + data diff --git a/Paimon_Info/get_data.py b/Paimon_Info/get_data.py index 79ae86a..aec14c9 100644 --- a/Paimon_Info/get_data.py +++ b/Paimon_Info/get_data.py @@ -254,8 +254,8 @@ async def get_sign_list(): async def get_enka_data(uid): for _ in range(3): try: - url = f'https://enka.shinshin.moe/u/{uid}/__data.json' - resp = await aiorequests.get(url=url, follow_redirects=True) + url = f'https://enka.network/u/{uid}/__data.json' + resp = await aiorequests.get(url=url, headers={'User-Agent': 'LittlePaimon'}, follow_redirects=True) data = resp.json() return data except Exception: