From abe61d115639b309f8bf9348333ca471f5fddf34 Mon Sep 17 00:00:00 2001 From: Joe Gitta Date: Wed, 27 May 2026 14:19:12 +0000 Subject: [PATCH] deploy: cache and render source name for news items --- browser.py | 7 ++++--- news.html | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/browser.py b/browser.py index 93a59d5..367043b 100755 --- a/browser.py +++ b/browser.py @@ -870,8 +870,8 @@ if __name__ == "__main__": cache_file = _HOME / "kiosk-home" / "news-data.json" feeds = { - "World News": "http://feeds.bbci.co.uk/news/world/rss.xml", - "National News": "https://feeds.npr.org/1001/rss.xml" + "World News": ("http://feeds.bbci.co.uk/news/world/rss.xml", "BBC News"), + "National News": ("https://feeds.npr.org/1001/rss.xml", "NPR News") } def scrape_article(url): @@ -917,7 +917,7 @@ if __name__ == "__main__": while True: payload = {} - for category, url in feeds.items(): + for category, (url, source_name) in feeds.items(): try: req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"}) xml_raw = urllib.request.urlopen(req, timeout=12).read() @@ -953,6 +953,7 @@ if __name__ == "__main__": "title": t_str, "summary": full_story if full_story else "Click to read the story details.", "image": img_url, + "source": source_name, "date": p_str }) payload[category] = stories diff --git a/news.html b/news.html index 2017f0a..4e79f4c 100644 --- a/news.html +++ b/news.html @@ -281,7 +281,7 @@
${story.image ? `` : ''}
${formattedSummary}
- +
`;