From 0dd27b4ec74761597c372dae67ee4b408a69bc9d Mon Sep 17 00:00:00 2001 From: miteruzo Date: Mon, 11 Nov 2024 12:31:19 +0900 Subject: [PATCH] =?UTF-8?q?#1=20=E5=BD=93=E6=97=A5=E3=81=AB=E3=81=A6?= =?UTF-8?q?=EF=BC=8C=E3=82=88=E3=82=8A=E5=B0=8F=E3=81=95=E3=81=84=E3=82=AD?= =?UTF-8?q?=E3=83=AA=E7=95=AA=E3=81=AF=E7=A5=9D=E3=81=AF=E3=81=AA=E3=81=83?= =?UTF-8?q?=E3=82=84=E3=81=85=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nico.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nico.py b/nico.py index be5f913..4fd8a28 100644 --- a/nico.py +++ b/nico.py @@ -25,11 +25,11 @@ CONFIG: dict[str, DbConfig] = { 'mysql': { 'driver': 'mysql', DB = DatabaseManager (CONFIG) Model.set_connection_resolver (DB) -KIRIBAN_VIEWS_COUNTS: set[int] = { *range (1_000, 10_000, 1_000), - *range (10_000, 1_000_001, 10_000), - 194, 245, 510, 810, 114_514, 1_940, 2_450, 5_100, - 19_400, 24_500, 51_000, 93_194, 2_424, 242_424, 1_919, 4_545, - 194_245, 245_194, 510_245 } +KIRIBAN_VIEWS_COUNTS: list[int] = sorted ({ *range (1_000, 10_000, 1_000), + *range (10_000, 1_000_001, 10_000), + 194, 245, 510, 810, 114_514, 1_940, 2_450, 5_100, + 19_400, 24_500, 51_000, 93_194, 2_424, 242_424, 1_919, + 4_545, 194_245, 245_194, 510_245 }) class VideoInfo (TypedDict): contentId: str @@ -143,6 +143,8 @@ def get_kiriban_list ( .where ('views_count', '>=', kiriban_views_count) .get ()) }) for code in targets: + if code in [kiriban[1]['contentId'] for kiriban in kiriban_list]: + continue video_info = get_video_info (code) if video_info is not None: kiriban_list.append ((kiriban_views_count, video_info,