mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-07-17 12:11:14 +08:00
fix:
- ui problem. - return rss link of searcher
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
from module.conf import settings
|
||||
from module.network import RequestContent
|
||||
|
||||
|
||||
class RSSSearcher(RequestContent):
|
||||
def __search_url(self, keywords: str) -> str:
|
||||
keywords.replace(" ", "+")
|
||||
url = f"{settings.rss_parser.custom_url}/RSS/Search?keyword={keywords}"
|
||||
return url
|
||||
|
||||
def search_keywords(self, keywords: str) -> list[dict]:
|
||||
url = self.__search_url(keywords)
|
||||
torrents = self.get_torrents(url)
|
||||
return torrents
|
||||
@@ -35,18 +35,16 @@ class SearchTorrent(RequestContent, RSSAnalyser):
|
||||
bangumi = self.torrent_to_data(torrent=torrent, rss=rss_item)
|
||||
if bangumi and bangumi not in exist_list:
|
||||
exist_list.append(bangumi)
|
||||
bangumi.rss_link = self.special_url(bangumi, site).url
|
||||
yield json.dumps(bangumi.dict(), separators=(',', ':'))
|
||||
|
||||
def search_season(self, data: Bangumi):
|
||||
@staticmethod
|
||||
def special_url(data: Bangumi, site: str) -> RSSItem:
|
||||
keywords = [getattr(data, key) for key in SEARCH_KEY if getattr(data, key)]
|
||||
url = search_url("mikan", keywords)
|
||||
torrents = self.search_torrents(url)
|
||||
return [torrent for torrent in torrents if data.title_raw in torrent.name]
|
||||
url = search_url(site, keywords)
|
||||
return url
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with SearchTorrent() as st:
|
||||
keywords = ["无职转生", "第二季"]
|
||||
bangumis = st.analyse_keyword(keywords)
|
||||
for bangumi in bangumis:
|
||||
print(bangumi)
|
||||
def search_season(self, data: Bangumi, site: str = "mikan") -> list[Torrent]:
|
||||
rss_item = self.special_url(data, site)
|
||||
torrents = self.search_torrents(rss_item)
|
||||
return [torrent for torrent in torrents if data.title_raw in torrent.name]
|
||||
Reference in New Issue
Block a user