diff --git a/src/generator.py b/src/generator.py index 3f36c51..60e85ba 100644 --- a/src/generator.py +++ b/src/generator.py @@ -1,9 +1,12 @@ +from functools import lru_cache + from loguru import logger import models import scraper +@lru_cache(maxsize=None) class Generator: def __init__(self, rss): diff --git a/src/tools.py b/src/tools.py index 2fbfd9a..9271267 100644 --- a/src/tools.py +++ b/src/tools.py @@ -109,7 +109,7 @@ def get_yiyan(): :return:一言 """ try: - response = requests.get("https://v1.hitokoto.cn/?c=d&min_length=18&max_length=24&encode=text", + response = requests.get("https://v1.hitokoto.cn/?c=d&min_length=16&max_length=20&encode=text", timeout=30) # Set timeout to 5 seconds if response.status_code == 200: return response.text