mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-15 08:53:53 +08:00
28 lines
647 B
Python
28 lines
647 B
Python
import requests
|
|
from urllib.parse import quote
|
|
from cishu.cishubase import cishubase
|
|
|
|
import re
|
|
|
|
|
|
class weblio(cishubase):
|
|
|
|
def search(self, word):
|
|
url = "https://www.weblio.jp/content/" + quote(word)
|
|
x = requests.get(url, proxies=self.proxy).text
|
|
x = re.sub("<img(.*?)>", "", x)
|
|
_all = []
|
|
_xx = re.findall('<div class="kijiWrp">([\\s\\S]*?)<br class=clr>', x)
|
|
|
|
for xx in _xx:
|
|
|
|
xx = re.sub("<a(.*?)>", "", xx)
|
|
|
|
xx = re.sub("</a>", "", xx)
|
|
|
|
xx = re.sub('class="(.*?)"', "", xx)
|
|
_all.append(xx)
|
|
|
|
join = "<hr>".join(_all)
|
|
return join
|