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