diff --git a/backend/src/module/network/request_url.py b/backend/src/module/network/request_url.py index d4e17395..c6148074 100644 --- a/backend/src/module/network/request_url.py +++ b/backend/src/module/network/request_url.py @@ -87,11 +87,20 @@ class RequestURL: self.session = requests.Session() if settings.proxy.enable: if "http" in settings.proxy.type: - url = f"{settings.proxy.type}://{settings.proxy.host}:{settings.proxy.port}" - self.session.proxies = { - "https": url, - "http": url, - } + if settings.proxy.username: + username=settings.proxy.username + password=settings.proxy.password + url = f"http://{username}:{password}@{settings.proxy.host}:{settings.proxy.port}" + self.session.proxies = { + "http": url, + "https": url, + } + else: + url = f"http://{settings.proxy.host}:{settings.proxy.port}" + self.session.proxies = { + "http": url, + "https": url, + } elif settings.proxy.type == "socks5": self._socks5_proxy = True socks.set_default_proxy( diff --git a/backend/src/module/network/site/mikan.py b/backend/src/module/network/site/mikan.py index 00181a87..f581fdd2 100644 --- a/backend/src/module/network/site/mikan.py +++ b/backend/src/module/network/site/mikan.py @@ -4,8 +4,13 @@ def rss_parser(soup): torrent_homepage = [] for item in soup.findall("./channel/item"): torrent_titles.append(item.find("title").text) - torrent_urls.append(item.find("enclosure").attrib["url"]) - torrent_homepage.append(item.find("link").text) + enclosure = item.find("enclosure") + if enclosure is not None: + torrent_homepage.append(item.find("link").text) + torrent_urls.append(enclosure.attrib.get("url")) + else: + torrent_urls.append(item.find("link").text) + torrent_homepage.append("") return torrent_titles, torrent_urls, torrent_homepage diff --git a/backend/src/module/searcher/searcher.py b/backend/src/module/searcher/searcher.py index 1b44f4e6..71de3a9a 100644 --- a/backend/src/module/searcher/searcher.py +++ b/backend/src/module/searcher/searcher.py @@ -21,8 +21,9 @@ BangumiJSON: TypeAlias = str class SearchTorrent(RequestContent, RSSAnalyser): def search_torrents(self, rss_item: RSSItem) -> list[Torrent]: - torrents = self.get_torrents(rss_item.url) - return torrents + return self.get_torrents(rss_item.url) + # torrents = self.get_torrents(rss_item.url) + # return torrents def analyse_keyword( self, keywords: list[str], site: str = "mikan", limit: int = 5