Skip to content

Commit fe738bd

Browse files
committed
修复了翻译和日典功能的BUG
关掉了对DeepL的翻译支持 日典功能增加对新版页面的支持
1 parent 47cd828 commit fe738bd

5 files changed

Lines changed: 5 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# XUN_beta8.8
1+
# XUN_beta9.1
22

33
## 介绍
44

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
MAXINFO_REIMU = 3 # 上车功能查找目的地的最大数 | 类型为int>0
2222
MAXINFO_ANIME = 4 # 搜番功能查找番剧的最大数 | 类型为int>0
2323
MAXLINE_JD = 7 # 日语词典功能查找条目的内容所允许的最大行书 | 类型为int>0
24-
MAXWOED_JD = 300 # 日语词典功能查找条目的内容所允许的最大字数 | 类型为int>0
24+
MAXWOED_JD = 250 # 日语词典功能查找条目的内容所允许的最大字数 | 类型为int>0
2525

2626
# TimeLimit类
2727
TIMELIMIT_IMAGE = 7 # 识图功能的时间限制 | 类型为float

include/plugins/japanese_dictionary/data_source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def get_definition_of_word(word: str) -> str:
1919
if notfound:
2020
return notfound[0]
2121

22-
source = html.xpath('//div[@class="pbarTL"]/a/text()')
22+
source = html.xpath('//div[@class="pbarTL"]')
2323
definition = []
2424
d_html = html.xpath('//div[@class="kiji"]')
2525
for d in d_html:
@@ -49,7 +49,7 @@ async def get_definition_of_word(word: str) -> str:
4949
d = d[:MAXWOED_JD].strip()
5050
if line_is_hidden:
5151
d += "……\n[Note]……有内容被省略……"
52-
putline.append("【{}】\n{}".format(s,d))
52+
putline.append("【{}】\n{}".format(s.xpath('string(.)').strip(),d))
5353
repass = "\n\n".join(putline)
5454
if is_hidden:
5555
repass += "\n\n[Note]有条目过长被省略,更多释义请参考: {}".format(url)

include/plugins/translation/data_source.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import sys
77

88
from googletrans import Translator
9-
from pydeeplator.deepL import DeepLTranslator
10-
from pydeeplator.deepL import TranslateLanguageEnum, TranslateModeType
119

1210
sys.path.append('../../../')
1311
from config import TIMELIMIT_TRANSL, BAIDUAPPID_TRANSL, BAIDUKEY_TRANSL, TO_TRANSL
@@ -57,8 +55,6 @@ async def get_transl_of_content(content: str) -> str:
5755

5856
transl_d['Google 翻译'] = google_translator.translate(content, dest = TO_TRANSL).text
5957
transl_d['Baidu 翻译'] = baidu_translator(content, BAIDUAPPID_TRANSL, BAIDUKEY_TRANSL, 'auto', TO_TRANSL[:2])
60-
if TO_TRANSL[:2] == 'zh':
61-
transl_d['DeepL 翻译'] = deepl_translator(content)
6258

6359
repass = ""
6460
putline = []

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ requests==2.22.0
55
lxml==4.4.1
66
thulac==0.2.1
77
kth-timeoutdecorator==0.0.5
8-
googletrans==2.4.0
9-
pydeeplator==0.0.1
8+
googletrans==2.4.0

0 commit comments

Comments
 (0)