mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 21:14:23 +00:00
feat: update Google RSS feed handling and improve template rendering
This commit is contained in:
parent
5f897f1bd0
commit
8198010268
2 changed files with 17 additions and 5 deletions
|
@ -8,12 +8,13 @@ export default defineEventHandler(async (event) => {
|
|||
try {
|
||||
const feed = await parser.parseURL('https://news.google.com/rss?&hl=zh-TW&gl=TW&ceid=TW:zh-Hant')
|
||||
feed.items.forEach(async (item) => {
|
||||
const relatedNews = JSON.parse(await HTMLToJSON(item.content, true))
|
||||
const rawRelatedNews = await HTMLToJSON(item.content, true)
|
||||
const relatedNews = JSON.parse(rawRelatedNews.replace("ol", ""))
|
||||
array.push({
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
date: item.pubDate,
|
||||
relatedNews: relatedNews
|
||||
content: relatedNews
|
||||
});
|
||||
console.log(item.title);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue