From 367b5043cbf69f736ffa95fa37a69d8287921f06 Mon Sep 17 00:00:00 2001 From: retoor Date: Mon, 6 Oct 2025 06:04:14 +0000 Subject: [PATCH] feat: aggregate articles across newspapers and limit to 30 with whitespace cleanup --- routers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routers.py b/routers.py index e1d1c73..463c84f 100644 --- a/routers.py +++ b/routers.py @@ -555,15 +555,15 @@ async def newspaper_latest(request: Request): newspapers= list(db.query("select * from newspapers order by id desc limit 10")) except IndexError: pass - + articles = [] for newspaper in newspapers: - articles = json.loads(newspaper['articles_json']) - if articles: + articles += json.loads(newspaper['articles_json']) + if len(articles) > 30: for article in articles: for key, value in article.items(): - article[key] = str(value).strip() + article[key] = str(value).strip().replace(' ', '') return templates.TemplateResponse("newspaper_view.html", { "request": request, "newspaper": newspaper,