diff --git a/nico.py b/nico.py index 419438a..cf48ee7 100644 --- a/nico.py +++ b/nico.py @@ -130,9 +130,6 @@ def get_kiriban_list ( latest_fetched_at = cast (date, (VideoHistory .where ('fetched_at', '<=', base_date) .max ('fetched_at'))) - previous_fetched_at = cast (date, (VideoHistory - .where ('fetched_at', '<', latest_fetched_at) - .max ('fetched_at'))) for kiriban_views_count in KIRIBAN_VIEWS_COUNTS: targets = { vh.video.code for vh in (VideoHistory @@ -143,7 +140,9 @@ def get_kiriban_list ( if code in [kiriban[1]['contentId'] for kiriban in kiriban_list]: continue previous_views_count = cast (int, (VideoHistory - .where ('code', code) + .where_has ('videos', + lambda q: q.where ( + 'code', code)) .where ('fetched_at', '<', latest_fetched_at) .max ('views_count'))) if previous_views_count >= kiriban_views_count: