diff --git a/server/sources/coolapk/index.ts b/server/sources/coolapk/index.ts index 18bd344..ca3fc6a 100644 --- a/server/sources/coolapk/index.ts +++ b/server/sources/coolapk/index.ts @@ -27,7 +27,6 @@ export default defineSource({ headers: await genHeaders(), }) if (!r.data.length) throw new Error("Failed to fetch") - console.log(r.data[0]) return r.data.filter(k => k.id).map(i => ({ id: i.id, title: i.editor_title || load(i.message).text().split("\n")[0], diff --git a/server/sources/ifeng.ts b/server/sources/ifeng.ts index 28fafc9..7e11646 100644 --- a/server/sources/ifeng.ts +++ b/server/sources/ifeng.ts @@ -2,18 +2,22 @@ import type { NewsItem } from "@shared/types" export default defineSource(async () => { const html: string = await myFetch("https://www.ifeng.com/") - const regex = /var\s+allData\s*=\s*(\{[^]*?\});/g; - const match = regex.exec(html); + const regex = /var\s+allData\s*=\s*(\{[\s\S]*?\});/ + const match = regex.exec(html) const news: NewsItem[] = [] if (match) { - const realData = JSON.parse(match[1]) - realData.hotNews1.forEach((hotNews, i) => { + const realData = JSON.parse(match[1]) + const rawNews = realData.hotNews1 as { + url: string + title: string + newsTime: string + }[] + rawNews.forEach((hotNews) => { news.push({ id: hotNews.url, url: hotNews.url, title: hotNews.title, extra: { - hover: hotNews.title, date: hotNews.newsTime, }, }) diff --git a/shared/pinyin.json b/shared/pinyin.json index 55cc6ad..153b23a 100644 --- a/shared/pinyin.json +++ b/shared/pinyin.json @@ -42,5 +42,5 @@ "nowcoder": "niuke", "sspai": "shaoshupai", "juejin": "xitujuejin", - "ifeng": "fenghuangwang" + "ifeng": "fenghuangwang-redianzixun" } \ No newline at end of file diff --git a/shared/pre-sources.ts b/shared/pre-sources.ts index f33643f..d7dddd9 100644 --- a/shared/pre-sources.ts +++ b/shared/pre-sources.ts @@ -376,6 +376,7 @@ export const originSources = { column: "china", color: "red", type: "hottest", + title: "热点资讯", home: "https://www.ifeng.com", }, } as const satisfies Record diff --git a/shared/sources.json b/shared/sources.json index 27fcbf6..0ffe8f4 100644 --- a/shared/sources.json +++ b/shared/sources.json @@ -468,6 +468,7 @@ "interval": 600000 }, "ifeng": { + "title": "热点资讯", "name": "凤凰网", "type": "hottest", "column": "china",