mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
yd
This commit is contained in:
parent
ecb33ad9cb
commit
b574500888
@ -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('<section class="modules"(.*?)>([\\s\\S]*?)</section>', text)
|
||||
fnd = fnd.group()
|
||||
|
||||
tip = re.search('<div class="lang-tip-con"(.*?)</div>', fnd)
|
||||
if tip:
|
||||
tip = tip.group()
|
||||
fnd = fnd.replace(tip, "")
|
||||
style = re.search("<style(.*?)>([\\s\\S]*?)</style>", text)
|
||||
style = style.group()
|
||||
return '<div style="text-align: center;"><a href="{}">link</a></div><br>{}{}'.format(
|
||||
"https://dict.youdao.com/result?word={}&lang={}".format(
|
||||
quote(word), self.srclang
|
||||
),
|
||||
style,
|
||||
fnd,
|
||||
)
|
||||
return f'<div style="text-align: center;"><a href="{url}">link</a></div><br>{style}{fnd}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user