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)