mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 05:24:23 +00:00
feat: update footer link formatting and add shadcn-nuxt integration
- Refactored footer.vue to improve link formatting. - Updated nuxt.config.ts to include shadcn-nuxt and added necessary HTML attributes and meta tags for SEO. - Added new dependencies in package.json for class-variance-authority, clsx, lucide-vue-next, reka-ui, shadcn-nuxt, tailwind-merge, and tailwindcss-animate. - Cleaned up unused template tags in headlines.vue, index.vue, and news/[provider]/[slug].vue. - Simplified sources.vue template structure. - Improved login.vue styles for better animation. - Enhanced google.ts API handler for better error handling and code clarity. - Updated find/newsOrg.ts to ensure consistent code style. - Added CSS variables and improved Tailwind configuration in main.css and tailwind.config.js. - Created components.json for shadcn integration and added new UI components (Alert, Button, Progress) with respective styles and variants. - Implemented utility functions in utils.ts for class name merging and value updating.
This commit is contained in:
parent
830dbfe7f1
commit
e081c54624
25 changed files with 502 additions and 79 deletions
|
@ -1,29 +1,30 @@
|
|||
import Parser from 'rss-parser'
|
||||
import { HTMLToJSON } from 'html-to-json-parser';
|
||||
|
||||
import Parser from "rss-parser";
|
||||
import { HTMLToJSON } from "html-to-json-parser";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
let array = [];
|
||||
const parser = new Parser()
|
||||
const parser = new Parser();
|
||||
try {
|
||||
const feed = await parser.parseURL('https://news.google.com/rss?&hl=zh-TW&gl=TW&ceid=TW:zh-Hant')
|
||||
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 rawRelatedNews = await HTMLToJSON(item.content, true)
|
||||
const relatedNews = JSON.parse(rawRelatedNews.replace("ol", ""))
|
||||
array.push({
|
||||
title: item.title,
|
||||
link: item.link,
|
||||
date: item.pubDate,
|
||||
content: relatedNews
|
||||
});
|
||||
console.log(item.title);
|
||||
})
|
||||
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,
|
||||
content: relatedNews,
|
||||
});
|
||||
console.log(item.title);
|
||||
});
|
||||
return array;
|
||||
} catch (error) {
|
||||
console.error('Error fetching RSS:', error)
|
||||
console.error("Error fetching RSS:", error);
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: 'Failed to fetch RSS feed'
|
||||
})
|
||||
message: "Failed to fetch RSS feed",
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue