From 75cb8d2a3caef0c09f1b4f5883840fc5d110afc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 12 Feb 2026 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(torrents):=20=E4=BF=AE=E5=A4=8D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=AB=99=E7=82=B9=E8=B5=84=E6=BA=90=E6=97=B6=E5=9B=A0?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=A7=8D=E5=AD=90=E9=93=BE=E6=8E=A5=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=20'Failed=20to=20exists=20key:=20None'=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/torrents.py | 3 +++ app/helper/torrent.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/chain/torrents.py b/app/chain/torrents.py index eb1362bc..8ee07a80 100644 --- a/app/chain/torrents.py +++ b/app/chain/torrents.py @@ -265,6 +265,9 @@ class TorrentsChain(ChainBase): for torrent in torrents: if global_vars.is_system_stopped: break + if not torrent.enclosure: + logger.warn(f"缺少种子链接,忽略处理: {torrent.title}") + continue logger.info(f'处理资源:{torrent.title} ...') # 识别 meta = MetaInfo(title=torrent.title, subtitle=torrent.description) diff --git a/app/helper/torrent.py b/app/helper/torrent.py index 2520c48d..91ac4712 100644 --- a/app/helper/torrent.py +++ b/app/helper/torrent.py @@ -25,7 +25,7 @@ class TorrentHelper: """ def __init__(self): - self._invalid_torrents = TTLCache(maxsize=128, ttl=3600 * 24) + self._invalid_torrents = TTLCache(region="invalid_torrents", maxsize=128, ttl=3600 * 24) def download_torrent(self, url: str, cookie: Optional[str] = None, @@ -340,11 +340,11 @@ class TorrentHelper: episodes = list(set(episodes).union(set(meta.episode_list))) return episodes - def is_invalid(self, url: str) -> bool: + def is_invalid(self, url: Optional[str]) -> bool: """ 判断种子是否是无效种子 """ - return url in self._invalid_torrents + return url in self._invalid_torrents if url else True def add_invalid(self, url: str): """