Browse Source

None の場合について考慮

main
みてるぞ 1 month ago
parent
commit
6d4e826439
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      nico.py

+ 7
- 6
nico.py View File

@@ -139,12 +139,13 @@ def get_kiriban_list (
for code in targets: for code in targets:
if code in [kiriban[1]['contentId'] for kiriban in kiriban_list]: if code in [kiriban[1]['contentId'] for kiriban in kiriban_list]:
continue 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: if previous_views_count >= kiriban_views_count:
continue continue
video_info = get_video_info (code) video_info = get_video_info (code)


Loading…
Cancel
Save