| @@ -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) | ||||