diff --git a/LunaTranslator/LunaTranslator/cishu/youdao.py b/LunaTranslator/LunaTranslator/cishu/youdao.py index 1696e181..d6e3cb9f 100644 --- a/LunaTranslator/LunaTranslator/cishu/youdao.py +++ b/LunaTranslator/LunaTranslator/cishu/youdao.py @@ -17,20 +17,20 @@ class youdao(cishubase): return "" def search(self, word): + url = "https://dict.youdao.com/result?word={}&lang={}".format( + quote(word), self.srclang + ) text = requests.get( - "https://dict.youdao.com/result?word={}&lang={}".format( - quote(word), self.srclang - ), + url, proxies=self.proxy, ).text fnd = re.search('
([\\s\\S]*?)
', text) fnd = fnd.group() + + tip = re.search('
', fnd) + if tip: + tip = tip.group() + fnd = fnd.replace(tip, "") style = re.search("([\\s\\S]*?)", text) style = style.group() - return '
link

{}{}'.format( - "https://dict.youdao.com/result?word={}&lang={}".format( - quote(word), self.srclang - ), - style, - fnd, - ) + return f'
link

{style}{fnd}'