diff --git a/LunaTranslator/LunaTranslator/cishu/cishubase.py b/LunaTranslator/LunaTranslator/cishu/cishubase.py index 4793f1a5..e4f8cb6c 100644 --- a/LunaTranslator/LunaTranslator/cishu/cishubase.py +++ b/LunaTranslator/LunaTranslator/cishu/cishubase.py @@ -30,9 +30,8 @@ class cishubase: except: self.needinit = True - if res is None or res == "": - return - self.callback(res) + if res and len(res): + self.callback(res) except: pass diff --git a/LunaTranslator/LunaTranslator/cishu/goo.py b/LunaTranslator/LunaTranslator/cishu/goo.py index 7907a3ad..c6a97ab0 100644 --- a/LunaTranslator/LunaTranslator/cishu/goo.py +++ b/LunaTranslator/LunaTranslator/cishu/goo.py @@ -17,10 +17,10 @@ class goo(cishubase): xx = re.sub("", "", xx) xx = re.sub("", "", xx) - - return ( - '
link
'.format( - url + if len(xx): + return ( + '
link
'.format( + url + ) + + xx ) - + xx - ) diff --git a/LunaTranslator/LunaTranslator/cishu/weblio.py b/LunaTranslator/LunaTranslator/cishu/weblio.py index d49c9a10..d0c070dc 100644 --- a/LunaTranslator/LunaTranslator/cishu/weblio.py +++ b/LunaTranslator/LunaTranslator/cishu/weblio.py @@ -25,10 +25,10 @@ class weblio(cishubase): _all.append(xx) join = "
".join(_all) - - return ( - '
link
'.format( - url + if len(join): + return ( + '
link
'.format( + url + ) + + join ) - + join - ) diff --git a/LunaTranslator/LunaTranslator/cishu/youdao.py b/LunaTranslator/LunaTranslator/cishu/youdao.py index 39300d49..2e7dc06c 100644 --- a/LunaTranslator/LunaTranslator/cishu/youdao.py +++ b/LunaTranslator/LunaTranslator/cishu/youdao.py @@ -25,11 +25,13 @@ class youdao(cishubase): proxies=getproxy(), ).text fnd = re.findall('
([\\s\\S]*?)
', text) - return ( - '
link

'.format( - "https://dict.youdao.com/result?word={}&lang={}".format( - quote(word), self.srclang + + if len(fnd[0][1]): + return ( + '
link

'.format( + "https://dict.youdao.com/result?word={}&lang={}".format( + quote(word), self.srclang + ) ) + + fnd[0][1] ) - + fnd[0][1] - )