mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-23 18:11:37 +08:00
2.5.15
- 修复少量变量 - 开启 刷新 RSS 选项
This commit is contained in:
@@ -28,7 +28,7 @@ DEFAULT_SETTINGS = {
|
||||
"enable_rename": True,
|
||||
"reset_folder": False,
|
||||
"log_path": "/config/log.txt",
|
||||
"refresh_rss": True,
|
||||
"refresh_rss": False,
|
||||
}
|
||||
|
||||
ENV_TO_ATTR = {
|
||||
@@ -55,7 +55,8 @@ ENV_TO_ATTR = {
|
||||
"AB_SOCKS": "socks",
|
||||
"AB_RENAME": ("enable_rename", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_RSS_COLLECTOR": ("enable_rss_collector", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_RESET_FOLDER": ("reset_folder", lambda e: e.lower() in ("true", "1", "t"))
|
||||
"AB_RESET_FOLDER": ("reset_folder", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_REFRESH_RSS": ("refresh_rss", lambda e: e.lower() in ("true", "1", "t")),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,25 +17,25 @@ class RequestContent:
|
||||
self._req = RequestURL()
|
||||
|
||||
# Mikanani RSS
|
||||
def get_torrents(self, url: str) -> [TorrentInfo]:
|
||||
soup = self._req.get_content(url)
|
||||
def get_torrents(self, _url: str) -> [TorrentInfo]:
|
||||
soup = self._req.get_content(_url)
|
||||
torrent_titles = [item.title.string for item in soup.find_all("item")]
|
||||
torrent_urls = [item.get("url") for item in soup.find_all("enclosure")]
|
||||
torrents = []
|
||||
for title, torrent_url in zip(torrent_titles, torrent_urls):
|
||||
if re.search(settings.not_contain, title) is None:
|
||||
torrents.append(TorrentInfo(title, torrent_url))
|
||||
for _title, torrent_url in zip(torrent_titles, torrent_urls):
|
||||
if re.search(settings.not_contain, _title) is None:
|
||||
torrents.append(TorrentInfo(_title, torrent_url))
|
||||
return torrents
|
||||
|
||||
def get_torrent(self, url) -> TorrentInfo:
|
||||
soup = self._req.get_content(url)
|
||||
def get_torrent(self, _url) -> TorrentInfo:
|
||||
soup = self._req.get_content(_url)
|
||||
item = soup.find("item")
|
||||
enclosure = item.find("enclosure")
|
||||
return TorrentInfo(item.title.string, enclosure["url"])
|
||||
|
||||
# API JSON
|
||||
def get_json(self, url) -> dict:
|
||||
return self._req.get_content(url, content="json")
|
||||
def get_json(self, _url) -> dict:
|
||||
return self._req.get_content(_url, content="json")
|
||||
|
||||
def close_session(self):
|
||||
self._req.close()
|
||||
|
||||
@@ -38,6 +38,7 @@ class RequestURL:
|
||||
return req
|
||||
except Exception as e:
|
||||
logger.debug(f"URL: {url}")
|
||||
logger.debug(e)
|
||||
logger.warning("ERROR with Connection.Please check DNS/Connection settings")
|
||||
time.sleep(settings.connect_retry_interval)
|
||||
times += 1
|
||||
|
||||
Reference in New Issue
Block a user