diff options
Diffstat (limited to 'routes.py')
| -rw-r--r-- | routes.py | 25 |
1 files changed, 0 insertions, 25 deletions
@@ -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')" |
