diff --git a/public/icons/fastbull.png b/public/icons/fastbull.png new file mode 100644 index 0000000..382a471 Binary files /dev/null and b/public/icons/fastbull.png differ diff --git a/server/sources/fastbull.ts b/server/sources/fastbull.ts new file mode 100644 index 0000000..2558b58 --- /dev/null +++ b/server/sources/fastbull.ts @@ -0,0 +1,57 @@ +import * as cheerio from "cheerio" +import type { NewsItem } from "@shared/types" + +const express = defineSource(async () => { + const baseURL = "https://www.fastbull.cn" + const html: any = await $fetch(`${baseURL}/express-news`) + const $ = cheerio.load(html) + const $main = $(".news-list") + const news: NewsItem[] = [] + $main.each((_, el) => { + const a = $(el).find(".title_name") + const url = a.attr("href") + const titleText = a.text() + const title = titleText.match(/【(.+)】/)?.[1] ?? titleText + const date = $(el).attr("data-date") + if (url && title && date) { + news.push({ + url: baseURL + url, + title: title.length < 4 ? titleText : title, + id: url, + pubDate: Number(date), + }) + } + }) + return news +}) + +const news = defineSource(async () => { + const baseURL = "https://www.fastbull.cn" + const html: any = await $fetch(`${baseURL}/news`) + const $ = cheerio.load(html) + const $main = $(".trending_type") + const news: NewsItem[] = [] + $main.each((_, el) => { + const a = $(el) + const url = a.attr("href") + const title = a.find(".title").text() + const date = a.find("[data-date]").attr("data-date") + if (url && title && date) { + news.push({ + url: baseURL + url, + title, + id: url, + pubDate: Number(date), + }) + } + }) + return news +}) + +export default defineSource( + { + "fastbull": express, + "fastbull-express": express, + "fastbull-news": news, + }, +) diff --git a/server/sources/index.ts b/server/sources/index.ts index 26a525c..851fb85 100644 --- a/server/sources/index.ts +++ b/server/sources/index.ts @@ -16,6 +16,7 @@ import xueqiu from "./xueqiu" import gelonghui from "./gelonghui" import tieba from "./tieba" import thepaper from "./thepaper" +import fastbull from "./fastbull" import type { SourceGetter } from "#/types" export const sourcesGetters = { @@ -28,6 +29,7 @@ export const sourcesGetters = { cankaoxiaoxi, thepaper, sputniknewscn, + ...fastbull, ...wallstreetcn, ...xueqiu, gelonghui, diff --git a/shared/metadata.ts b/shared/metadata.ts index 2045783..593b4ec 100644 --- a/shared/metadata.ts +++ b/shared/metadata.ts @@ -19,7 +19,17 @@ const originMetadata: Metadata = { }, finance: { name: "财经", - sources: ["cls-telegraph", "cls-depth", "wallstreetcn", "wallstreetcn-hot", "wallstreetcn-news", "xueqiu-hotstock", "gelonghui"], + sources: [ + "cls-telegraph", + "cls-depth", + "wallstreetcn", + "wallstreetcn-hot", + "wallstreetcn-news", + "xueqiu-hotstock", + "gelonghui", + "fastbull-express", + "fastbull-news", + ], }, focus: { name: "关注", diff --git a/shared/sources.ts b/shared/sources.ts index a608623..51f9658 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -169,6 +169,22 @@ export const originSources = { interval: Time.Realtime, home: "https://www.gelonghui.com", }, + "fastbull": { + name: "法布财经", + color: "emerald", + home: "https://www.fastbull.cn", + sub: { + express: { + title: "快讯", + type: "realtime", + interval: Time.Realtime, + }, + news: { + title: "头条", + interval: Time.Common, + }, + }, + }, } as const satisfies Record export const sources = genSources() diff --git a/shared/types.ts b/shared/types.ts index 7fd27ce..ce86227 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -75,6 +75,7 @@ export interface NewsItem { title: string url: string mobileUrl?: string + pubDate?: number | string extra?: Record } diff --git a/src/components/column/card.tsx b/src/components/column/card.tsx index ca943bf..5542d57 100644 --- a/src/components/column/card.tsx +++ b/src/components/column/card.tsx @@ -216,7 +216,7 @@ function NewsListTimeLine({ query }: Query) { - - {item?.extra?.date && } + {(item.pubDate || item.extra?.date) && }