summaryrefslogtreecommitdiffstats
path: root/routes.py
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-05-09 22:02:33 -0700
committerPinapelz <yukais@pinapelz.com>2025-05-09 22:10:12 -0700
commit8df4ae55d99438b13d0394fd865334c30f5b8a09 (patch)
treed383e773e17413dd5e4fb3a011c5855d5d819bc5 /routes.py
parent785db1be35f71347211eca76d279d700494061f2 (diff)
feat: implement uploading cached api endpoints
Diffstat (limited to 'routes.py')
-rw-r--r--routes.py25
1 files changed, 0 insertions, 25 deletions
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')"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage