Skip to content

Commit

Permalink
fix: parse_nyaa func raise NetError
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohrusky committed Dec 23, 2024
1 parent 7304846 commit a37d3d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion animepipeline/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ async def start(self) -> None:
# refresh rss config
self.rss_config.refresh_config()
for cfg in self.rss_config.nyaa:
torrent_info_list = parse_nyaa(cfg)
try:
torrent_info_list = parse_nyaa(cfg)
except Exception as e:
logger.error(f"Failed to parse nyaa for {cfg.name}: {e}")
continue

for torrent_info in torrent_info_list:
task_info = build_task_info(
Expand Down
4 changes: 2 additions & 2 deletions animepipeline/rss/nyaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import feedparser
import httpx
from loguru import logger
from tenacity import retry, stop_after_attempt, stop_after_delay, wait_random
from tenacity import retry, stop_after_attempt, wait_random

from animepipeline.config import NyaaConfig
from animepipeline.rss.type import TorrentInfo


@retry(wait=wait_random(min=3, max=5), stop=stop_after_delay(10) | stop_after_attempt(30))
@retry(wait=wait_random(min=3, max=15), stop=stop_after_attempt(10))
def parse_nyaa(cfg: NyaaConfig) -> List[TorrentInfo]:
rss_content = httpx.get(cfg.link).text

Expand Down

0 comments on commit a37d3d2

Please sign in to comment.