From 0fc328cc75dc126aa3a4bd6f0649b6b8b36098c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 22 Apr 2024 12:36:37 +0800 Subject: [PATCH] Update ali.py --- LunaTranslator/LunaTranslator/translator/ali.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/LunaTranslator/LunaTranslator/translator/ali.py b/LunaTranslator/LunaTranslator/translator/ali.py index 179ac119..b341bcaa 100644 --- a/LunaTranslator/LunaTranslator/translator/ali.py +++ b/LunaTranslator/LunaTranslator/translator/ali.py @@ -1,4 +1,4 @@ -import re +import re, html from translator.basetranslator import basetrans @@ -80,11 +80,4 @@ class TS(basetrans): trans = data["data"]["translateText"] except: raise Exception(r.text) - xx = re.findall("&#(.*?);", trans) - xx = set(xx) - for _x in xx: - try: - trans = trans.replace("&#{};".format(_x), chr(int(_x))) - except: - pass - return trans + return html.unescape(trans)