deploy: cache and render source name for news items

This commit is contained in:
2026-05-27 14:19:12 +00:00
parent 79b6d4857d
commit abe61d1156
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -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