This commit is contained in:
恍兮惚兮 2024-05-18 01:55:02 +08:00
parent f9563995a1
commit 7ad0956e6e
4 changed files with 22 additions and 21 deletions

View File

@ -30,9 +30,8 @@ class cishubase:
except: except:
self.needinit = True self.needinit = True
if res is None or res == "": if res and len(res):
return self.callback(res)
self.callback(res)
except: except:
pass pass

View File

@ -17,10 +17,10 @@ class goo(cishubase):
xx = re.sub("<a([\\s\\S]*?)>", "", xx) xx = re.sub("<a([\\s\\S]*?)>", "", xx)
xx = re.sub("</a>", "", xx) xx = re.sub("</a>", "", xx)
if len(xx):
return ( return (
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format( '<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
url url
)
+ xx
) )
+ xx
)

View File

@ -25,10 +25,10 @@ class weblio(cishubase):
_all.append(xx) _all.append(xx)
join = "<br>".join(_all) join = "<br>".join(_all)
if len(join):
return ( return (
'<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format( '<div style="text-align: center;"><a target="_blank" href="{}">link</a></div>'.format(
url url
)
+ join
) )
+ join
)

View File

@ -25,11 +25,13 @@ class youdao(cishubase):
proxies=getproxy(), proxies=getproxy(),
).text ).text
fnd = re.findall('<section class="modules"(.*?)>([\\s\\S]*?)</section>', 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( if len(fnd[0][1]):
"https://dict.youdao.com/result?word={}&lang={}".format( return (
quote(word), self.srclang '<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]
)