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}
-
⌚ Published: ${story.date || 'Recent'}
+
📰 Source: ${story.source || 'Daily Digest'} | ⌚ Published: ${story.date || 'Recent'}
`;