From dd47deb954a795e31a095c49bd953be3fa2df99d Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Wed, 9 Apr 2025 14:46:57 +1000 Subject: [PATCH] fix: news not loading --- package.json | 1 + src/background/news.ts | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ea888134..9d9f39a5 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "dompurify": "^3.2.4", "embla-carousel-autoplay": "^8.5.2", "embla-carousel-svelte": "^8.5.2", + "events": "^3.3.0", "fuse.js": "^7.1.0", "idb": "^8.0.2", "localforage": "^1.10.0", diff --git a/src/background/news.ts b/src/background/news.ts index 3bb52f9e..72c647a2 100644 --- a/src/background/news.ts +++ b/src/background/news.ts @@ -19,20 +19,25 @@ const rssFeedsByCountry: Record = { "https://www.npr.org/rss/rss.php", ], taiwan: [ - "https://focustaiwan.tw/rss", - "https://www.taipeitimes.com/rss/all.xml", + "https://news.ltn.com.tw/rss/all.xml", + "https://www.taipeitimes.com/xml/index.rss", "https://international.thenewslens.com/rss", ], hong_kong: [ - "https://news.rthk.hk/rthk/en/rss.htm", + "https://rthk9.rthk.hk/rthk/news/rss/e_expressnews_elocal.xml", "https://www.scmp.com/rss/91/feed", ], panama: [ - "http://www.panama-guide.com/backend.php", + "https://critica.com.pa/rss.xml", + "https://www.panamaamerica.com.pa/rss.xml", + "https://noticiassin.com/feed/", + "https://elcapitalfinanciero.com/feed/" ], canada: [ "https://www.cbc.ca/cmlink/rss-topstories", - "https://www.theglobeandmail.com/?service=rss", + "https://calgaryherald.com/feed", + "https://ottawacitizen.com/feed", + "https://www.montrealgazette.com/feed" ], singapore: [ "https://www.straitstimes.com/news/singapore/rss.xml", @@ -43,20 +48,16 @@ const rssFeedsByCountry: Record = { "https://www.theguardian.com/uk/rss", ], japan: [ - "https://www.japantimes.co.jp/feed/topstories.xml", "https://www3.nhk.or.jp/nhkworld/en/news/feeds/", + "https://news.livedoor.com/topics/rss/int.xml" ], netherlands: [ "https://www.dutchnews.nl/feed/", - "http://feeds.nos.nl/nosnieuwsalgemeen", + "https://www.nrc.nl/rss/" ], }; export async function fetchNews(source: string, sendResponse: any) { - const parser = new Parser(); - let feeds: string[]; - console.log('fetchNews', source) - if (source === "australia") { const date = new Date(); @@ -73,6 +74,10 @@ export async function fetchNews(source: string, sendResponse: any) { return; } + const parser = new Parser(); + let feeds: string[]; + console.log('fetchNews', source) + if (rssFeedsByCountry[source.toLowerCase()]) { // If the source is a country, fetch from predefined feeds feeds = rssFeedsByCountry[source.toLowerCase()];