From 8df4ae55d99438b13d0394fd865334c30f5b8a09 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Fri, 9 May 2025 22:02:33 -0700 Subject: feat: implement uploading cached api endpoints --- routes.py | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'routes.py') diff --git a/routes.py b/routes.py index 06c68e9..324cb4f 100644 --- a/routes.py +++ b/routes.py @@ -29,31 +29,6 @@ def get_subscribers_data(): } for row in data] return {"timestamp": datetime.datetime.now(), "channel_data": channel_data_list} -def get_twitch_data(): - server = create_database_connection() - query = ''' - SELECT sd.*, h.*, ts.follower_count - FROM subscriber_data sd - INNER JOIN "24h_historical" h ON sd.channel_id = h.channel_id - LEFT JOIN twitch_stats ts ON sd.channel_id = ts.channel_id - ORDER BY sd.subscriber_count DESC - ''' - data = server.execute_query(query) - channel_data_list = [] - for row in data: - youtube_subs = row[4] - twitch_followers = row[-1] if row[-1] is not None else 0 - total_followers = youtube_subs + twitch_followers - channel_data_list.append({ - "channel_name": row[3], - "profile_pic": row[2], - "subscribers": youtube_subs, - "sub_org": row[5], - "twitch_followers": twitch_followers, - "total_sum": total_followers, - }) - return {"timestamp": datetime.datetime.now(), "channel_data": channel_data_list} - def get_channel_timeseries(channel_name): server = create_database_connection() query = "SELECT * FROM subscriber_data_historical WHERE name = %s AND timestamp > %s ORDER BY TO_CHAR(timestamp, 'YYYY-MM-DD')" -- cgit v1.2.3