mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
f9563995a1
commit
7ad0956e6e
@ -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
|
||||
|
||||
|
@ -17,10 +17,10 @@ class goo(cishubase):
|
||||
xx = re.sub("<a([\\s\\S]*?)>", "", xx)
|
||||
|
||||
xx = re.sub("</a>", "", xx)
|
||||
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||
url
|
||||
if len(xx):
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||
url
|
||||
)
|
||||
+ xx
|
||||
)
|
||||
+ xx
|
||||
)
|
||||
|
@ -25,10 +25,10 @@ class weblio(cishubase):
|
||||
_all.append(xx)
|
||||
|
||||
join = "<br>".join(_all)
|
||||
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||
url
|
||||
if len(join):
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
|
||||
url
|
||||
)
|
||||
+ join
|
||||
)
|
||||
+ join
|
||||
)
|
||||
|
@ -25,11 +25,13 @@ class youdao(cishubase):
|
||||
proxies=getproxy(),
|
||||
).text
|
||||
fnd = re.findall('<section class="modules"(.*?)>([\\s\\S]*?)</section>', text)
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div><br>'.format(
|
||||
"https://dict.youdao.com/result?word={}&lang={}".format(
|
||||
quote(word), self.srclang
|
||||
|
||||
if len(fnd[0][1]):
|
||||
return (
|
||||
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div><br>'.format(
|
||||
"https://dict.youdao.com/result?word={}&lang={}".format(
|
||||
quote(word), self.srclang
|
||||
)
|
||||
)
|
||||
+ fnd[0][1]
|
||||
)
|
||||
+ fnd[0][1]
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user