newsnow/server/sources/peopledaily.ts

18 lines
528 B
TypeScript
Raw Normal View History

2024-10-03 17:24:29 +08:00
import type { RSS2JSON, SourceInfo } from "@shared/types"
2024-10-03 13:16:14 +08:00
import { rss2json } from "#/utils/rss2json"
2024-10-03 17:24:29 +08:00
export async function peopledaily(): Promise<SourceInfo> {
2024-10-03 13:16:14 +08:00
const source = await rss2json("https://feedx.net/rss/people.xml")
if (!source?.items.length) throw new Error("Cannot fetch data")
return {
2024-10-03 17:24:29 +08:00
name: "人民日报",
type: "报纸",
updateTime: Date.now(),
items: source.items.slice(0, 30).map((item: RSS2JSON) => ({
title: item.title,
url: item.link,
id: item.link,
})),
2024-10-03 13:16:14 +08:00
}
}