mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
chore: add kaopu.news
This commit is contained in:
parent
7351d1ed9f
commit
392a24c817
BIN
public/icons/kaopu.png
Normal file
BIN
public/icons/kaopu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
1
server/glob.d.ts
vendored
1
server/glob.d.ts
vendored
@ -12,6 +12,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
||||
export const github: typeof import('./sources/github')
|
||||
export const hackernews: typeof import('./sources/hackernews')
|
||||
export const ithome: typeof import('./sources/ithome')
|
||||
export const kaopu: typeof import('./sources/kaopu')
|
||||
export const producthunt: typeof import('./sources/producthunt')
|
||||
export const solidot: typeof import('./sources/solidot')
|
||||
export const sputniknewscn: typeof import('./sources/sputniknewscn')
|
||||
|
27
server/sources/kaopu.ts
Normal file
27
server/sources/kaopu.ts
Normal file
@ -0,0 +1,27 @@
|
||||
type Res = {
|
||||
description: string
|
||||
link: string
|
||||
// Date
|
||||
pubDate: string
|
||||
publisher: string
|
||||
title: string
|
||||
}[]
|
||||
export default defineSource(async () => {
|
||||
const url = "https://kaopucdn.azureedge.net/jsondata/news_list_beta_hans_0.json"
|
||||
const res: Res = await $fetch(url)
|
||||
return res
|
||||
.slice(0, 30)
|
||||
.map((k) => {
|
||||
return {
|
||||
id: k.link,
|
||||
title: k.title,
|
||||
pubDate: k.pubDate,
|
||||
extra: {
|
||||
hover: k.description,
|
||||
info: k.publisher,
|
||||
},
|
||||
url: k.link,
|
||||
}
|
||||
})
|
||||
},
|
||||
)
|
@ -7,11 +7,11 @@ export const columnIds = ["focus", "realtime", "hottest", "china", "world", "tec
|
||||
const originMetadata: Metadata = {
|
||||
china: {
|
||||
name: "国内",
|
||||
sources: ["zhihu", "thepaper"],
|
||||
sources: ["zhihu", "thepaper", "douyin", "bilibili-hot-search", "weibo", "toutiao", "tieba"],
|
||||
},
|
||||
world: {
|
||||
name: "国际",
|
||||
sources: ["zaobao", "cankaoxiaoxi"],
|
||||
sources: ["zaobao", "cankaoxiaoxi", "kaopu"],
|
||||
},
|
||||
tech: {
|
||||
name: "科技",
|
||||
|
@ -225,6 +225,11 @@ export const originSources = {
|
||||
},
|
||||
},
|
||||
},
|
||||
"kaopu": {
|
||||
name: "靠谱新闻",
|
||||
color: "gray",
|
||||
home: "https://kaopu.news/",
|
||||
},
|
||||
} as const satisfies Record<string, OriginSource>
|
||||
|
||||
export const sources = genSources()
|
||||
|
@ -143,7 +143,7 @@ function NewsCard({ id, inView, handleListeners }: NewsCardProps) {
|
||||
defer
|
||||
>
|
||||
<div className={clsx("transition-opacity-500", isFreshFetching && "op-20")}>
|
||||
{data?.items?.length && (sources[id].type === "hottest" ? <NewsListHot items={data.items} /> : <NewsListTimeLine items={data.items} />)}
|
||||
{!!data?.items?.length && (sources[id].type === "hottest" ? <NewsListHot items={data.items} /> : <NewsListTimeLine items={data.items} />)}
|
||||
</div>
|
||||
</OverlayScrollbar>
|
||||
</>
|
||||
|
Loading…
x
Reference in New Issue
Block a user