From 6d4e826439134df6cfd5efb90d6d91557e20a722 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Fri, 3 Jan 2025 17:40:10 +0900 Subject: [PATCH] =?UTF-8?q?None=20=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB?= =?UTF-8?q?=E3=81=A4=E3=81=84=E3=81=A6=E8=80=83=E6=85=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nico.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nico.py b/nico.py index 8c40543..4d1fa3c 100644 --- a/nico.py +++ b/nico.py @@ -139,12 +139,13 @@ def get_kiriban_list ( for code in targets: if code in [kiriban[1]['contentId'] for kiriban in kiriban_list]: continue - previous_views_count = cast (int, (VideoHistory - .where_has ('video', - lambda q: q.where ( - 'code', code)) - .where ('fetched_at', '<', latest_fetched_at) - .max ('views_count'))) + previous_views_count: int | None = ( + VideoHistory + .where_has ('video', lambda q: q.where ('code', code)) + .where ('fetched_at', '<', latest_fetched_at) + .max ('views_count')) + if previous_views_count is None: + previous_views_count = 0 if previous_views_count >= kiriban_views_count: continue video_info = get_video_info (code)