Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvandia committed Jul 29, 2023
1 parent 1ecbe06 commit cc2fc41
Show file tree
Hide file tree
Showing 3 changed files with 2,059 additions and 16 deletions.
20 changes: 4 additions & 16 deletions dimtown/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@ class Search(AnimeAvatar):
def __init__(self, key_words) -> None:
super().__init__()
self.key_words = key_words
self.api_url = self.base_url

async def _save_html(self, file_name: str) -> bool:
"""
保存网页
参数:
- file_name: 文件名
返回:
- bool: 是否保存成功
"""
await super()._save_html(self.api_url, file_name)
self.api_url = self.base_url + "/page/1" + "?s=" + self.key_words

async def get_search_list(self, page: int = 1) -> list:
"""
Expand All @@ -34,7 +22,7 @@ async def get_search_list(self, page: int = 1) -> list:
返回:
- list: 搜索列表
"""
url = self.api_url + "/page/" + str(page)
url = self.api_url.replace("1", str(page))
try:
resp = await self._get_resp(url, params={"s": self.key_words})
except Exception:
Expand All @@ -58,7 +46,7 @@ async def get_search_title(self, page: int = 1) -> list:
返回:
- list: 搜索标题
"""
url = self.api_url + "/page/" + str(page)
url = self.api_url.replace("1", str(page))
try:
resp = await self._get_resp(url, params={"s": self.key_words})
except Exception:
Expand Down Expand Up @@ -90,4 +78,4 @@ async def get_search_img(self, url: str) -> list:
tags = a.get_text()
if "头像" in tags:
return await super().get_animeavatar_img(url)
return await super().get_img_list(url)
return await super().get_img_url(url)
Loading

0 comments on commit cc2fc41

Please sign in to comment.