mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-28 23:25:01 +08:00
Merge pull request #548 from jue0115/main
fix http(s) socks5 nyaa search
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user