diff --git a/plugins/alert.py b/plugins/alert.py index 6531c60..32036eb 100644 --- a/plugins/alert.py +++ b/plugins/alert.py @@ -20,7 +20,6 @@ _log = logging.getLogger(__name__) _NAME_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,19}$") _MAX_KEYWORD_LEN = 100 _MAX_SEEN = 200 -_MAX_ANNOUNCE = 5 _DEFAULT_INTERVAL = 300 _MAX_INTERVAL = 3600 _FETCH_TIMEOUT = 15 @@ -181,7 +180,7 @@ def _search_youtube(keyword: str) -> list[dict]: req = urllib.request.Request(_YT_SEARCH_URL, data=payload, method="POST") req.add_header("Content-Type", "application/json") - resp = _urlopen(req, timeout=_FETCH_TIMEOUT) + resp = urllib.request.urlopen(req, timeout=_FETCH_TIMEOUT) raw = resp.read() resp.close() @@ -395,8 +394,7 @@ async def _poll_once(bot, key: str, announce: bool = True) -> None: if announce and matched: channel = data["channel"] name = data["name"] - shown = matched[:_MAX_ANNOUNCE] - for item in shown: + for item in matched: title = _truncate(item["title"]) if item["title"] else "(no title)" url = item["url"] date = item.get("date", "") @@ -407,9 +405,6 @@ async def _poll_once(bot, key: str, announce: bool = True) -> None: if url: line += f" -- {url}" await bot.send(channel, line) - remaining = len(matched) - len(shown) - if remaining > 0: - await bot.send(channel, f"[{name}/{tag}] ... and {remaining} more") for item in new_items: seen_list.append(item["id"])