feat: restructure README, remove Google and Yahoo components, and implement hot news display

This commit is contained in:
吳元皓 2025-05-08 14:06:35 +08:00
parent 8198010268
commit a5af4c04f7
6 changed files with 60 additions and 40 deletions

View File

@ -1,7 +1,20 @@
# 新聞解析 / News Analyze # 新聞解析 / News Analyze
## Stack: ## Why?
我們使用這個新聞來舉例:
```
朱立倫批政府像希特勒德國在台協會:不應為政治扭曲歷史| 政治 - 中央社 CNA
5/7/2025, 11:17:00 PM
類似新聞:
- 朱立倫批政府像希特勒德國在台協會:不應為政治扭曲歷史| 政治 - 中央社 CNA
- 快訊/硬起來!朱立倫回擊德國在台協會:外國政府不該干預各國內政 - 富房網
- 綠委憂希特勒說釀災 外交部:全力向駐台館處說明 - 經濟日報
- 「朱立倫道歉」!亂比喻遭德國、以色列譴責 民進黨:賠上台灣國際名譽 - 奇摩新聞
- 洪聖斐觀點》獨裁餘毒罵人「法西斯」 朱立倫東施效顰共產黨| 政治 - Newtalk新聞
```
你會看到許多觀點,但不知道這些新聞為什麼會寫比較偏見的文章。
## Stack:
- Postgres - Postgres
- Passport.js - Passport.js
- Tailwind - Tailwind
@ -12,3 +25,4 @@
- Minio S3 - Minio S3
- Nuxt i18N - Nuxt i18N
- BunJS - BunJS
- Groq

View File

@ -4,6 +4,7 @@ export default defineNuxtConfig({
routeRules: { routeRules: {
"/": { redirect: "/home" }, "/": { redirect: "/home" },
"/zh_tw": { redirect: "/zh_tw/home" }, "/zh_tw": { redirect: "/zh_tw/home" },
//"/api/rss/**": { swr: 3600 },
}, },
css: ["~/styles/main.css"], css: ["~/styles/main.css"],
modules: [ modules: [

39
pages/app/hot/index.vue Normal file
View File

@ -0,0 +1,39 @@
<script lang="ts" setup>
const ffeed = ref();
const ass = ['健康2.0', '中天', 'TVBS', '香港01', "ETtoday"];
try {
const { data } = await useFetch('/api/rss/google')
ffeed.value = data.value
} catch (error) {
console.error('Error:', error)
}
</script>
<template>
<div v-for="item in ffeed" class="justify-center align-center text-center p-4 border border-white rounded-lg m-4">
{{ item }}
<span class="text-xl text-bold text-gray-100">{{ item.title }}
<span v-if="ass.some((app) =>
item.title.includes(app)
)"
class="text-red-500 text-sm">
&nbsp;- 疑似來自有中資背景公司
</span>
</span>
<h4 class="text-gray-500 text-sm">{{ new Date(item.date).toLocaleString() }}</h4>
類似新聞:
<div v-for="itit in item.content">
<ul v-for="ititit in itit">
<li v-if="ititit.content?.[0].content[0] !== item.title">
&nbsp; - <a :href="ititit.content?.[0].attributes?.href">{{ ititit.content?.[0].content[0] }}</a> - <a :href="'/find/newsOrg?name=' + ititit.content?.[2].content[0]">{{ ititit.content?.[2].content[0] }}</a>
<span v-if="ass.some((app) => ititit.content?.[2].content[0].includes(app))"
class="text-red-500 text-sm">
&nbsp;- 疑似來自有中資背景公司
</span>
</li>
</ul>
</div>
</div>
</template>

View File

@ -1,36 +0,0 @@
<script lang="ts" setup>
const ffeed = ref();
try {
const { data } = await useFetch('/api/rss/google')
ffeed.value = data.value
} catch (error) {
console.error('Error:', error)
}
</script>
<template>
<hr/>
<div v-for="item in ffeed">
<span>{{ item.title }}
<span v-if="item.title.includes('.cn') || item.title.includes('健康2.0') ||
item.title.includes('中天') || item.title.includes('TVBS') ||
item.title.includes('香港01')"
class="text-red-500 text-sm">
&nbsp;- 疑似來自有中資背景公司
</span>
</span>
<h4>{{ item.date }}</h4>
類似新聞:
<div v-for="itit in item.content">
{{ itit }}
<ul v-for="ititit in itit">
<li>
&nbsp; - {{ ititit.content?.[0].content[0] }} - {{ ititit.content?.[2].content[0] }}
</li>
</ul>
</div>
<hr/>
</div>
</template>

View File

@ -1,3 +0,0 @@
<template>
https://tw.news.yahoo.com/rss/
</template>

View File

@ -0,0 +1,5 @@
export default defineEventHandler(async (event) => {
const query = getQuery(event)
const name = query.name
return name;
})