mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Remove legacy and/or code that is not used.
This commit is contained in:
parent
d99031b3b6
commit
5f3a721339
18 changed files with 4 additions and 203 deletions
|
@ -1,30 +0,0 @@
|
|||
import Parser from "rss-parser";
|
||||
import { HTMLToJSON } from "html-to-json-parser";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
let array = [];
|
||||
const parser = new Parser();
|
||||
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 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);
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: "Failed to fetch RSS feed",
|
||||
});
|
||||
}
|
||||
});
|
|
@ -48,6 +48,5 @@ export default defineEventHandler(async (event) => {
|
|||
current_spot: "KEEP_LOGIN",
|
||||
email: fetchViaSQL[0].email,
|
||||
avatarURL: fetchViaSQL[0].avatarurl,
|
||||
firstName: fetchViaSQL[0].firstName,
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import { S3Client } from "bun";
|
||||
|
||||
const s3config = new S3Client({
|
||||
accessKeyId: process.env.S3_ACCESS_KEY,
|
||||
secretAccessKey: process.env.S3_SECRET_KEY,
|
||||
bucket: process.env.S3_BUCKETNAME,
|
||||
acl: "public-read",
|
||||
endpoint: process.env.S3_ENDPOINT,
|
||||
});
|
||||
|
||||
export default s3config;
|
Loading…
Add table
Add a link
Reference in a new issue