Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingfengdev committed Jun 10, 2024
1 parent c4bb381 commit b706e9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions plugin/engine/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ def __init__(self, url, title, summary):
self.title = title
self.summary = summary

def __eq__(self, other):
return self.url == other.url

def __hash__(self):
return hash(self.url)


class SearchEngine(ABC):

Expand Down
5 changes: 4 additions & 1 deletion plugin/engine/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def get_bing_url(self, keywords):
return bing_url

def search(self, keywords) -> typing.List[SearchResult]:
keywords = f"我的世界 {translate(keywords)} 插件"
return list(set(self._search(f"我的世界 {translate(keywords)} 插件")) | set(
self._search(f"minecraft {translate(keywords, to_lang=EN)} plugin")))

def _search(self, keywords) -> typing.List[SearchResult]:
bing_url = self.get_bing_url(keywords)
result: typing.List[SearchResult] = []
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0',
Expand Down
Empty file added plugin/engine/spigotmc.py
Empty file.

0 comments on commit b706e9a

Please sign in to comment.