mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
feat(source): add fastbull.cn
This commit is contained in:
parent
3ae61cf9da
commit
ae57261fb9
BIN
public/icons/fastbull.png
Normal file
BIN
public/icons/fastbull.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
57
server/sources/fastbull.ts
Normal file
57
server/sources/fastbull.ts
Normal file
@ -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,
|
||||||
|
},
|
||||||
|
)
|
@ -16,6 +16,7 @@ import xueqiu from "./xueqiu"
|
|||||||
import gelonghui from "./gelonghui"
|
import gelonghui from "./gelonghui"
|
||||||
import tieba from "./tieba"
|
import tieba from "./tieba"
|
||||||
import thepaper from "./thepaper"
|
import thepaper from "./thepaper"
|
||||||
|
import fastbull from "./fastbull"
|
||||||
import type { SourceGetter } from "#/types"
|
import type { SourceGetter } from "#/types"
|
||||||
|
|
||||||
export const sourcesGetters = {
|
export const sourcesGetters = {
|
||||||
@ -28,6 +29,7 @@ export const sourcesGetters = {
|
|||||||
cankaoxiaoxi,
|
cankaoxiaoxi,
|
||||||
thepaper,
|
thepaper,
|
||||||
sputniknewscn,
|
sputniknewscn,
|
||||||
|
...fastbull,
|
||||||
...wallstreetcn,
|
...wallstreetcn,
|
||||||
...xueqiu,
|
...xueqiu,
|
||||||
gelonghui,
|
gelonghui,
|
||||||
|
@ -19,7 +19,17 @@ const originMetadata: Metadata = {
|
|||||||
},
|
},
|
||||||
finance: {
|
finance: {
|
||||||
name: "财经",
|
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: {
|
focus: {
|
||||||
name: "关注",
|
name: "关注",
|
||||||
|
@ -169,6 +169,22 @@ export const originSources = {
|
|||||||
interval: Time.Realtime,
|
interval: Time.Realtime,
|
||||||
home: "https://www.gelonghui.com",
|
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<string, OriginSource>
|
} as const satisfies Record<string, OriginSource>
|
||||||
|
|
||||||
export const sources = genSources()
|
export const sources = genSources()
|
||||||
|
@ -75,6 +75,7 @@ export interface NewsItem {
|
|||||||
title: string
|
title: string
|
||||||
url: string
|
url: string
|
||||||
mobileUrl?: string
|
mobileUrl?: string
|
||||||
|
pubDate?: number | string
|
||||||
extra?: Record<string, any>
|
extra?: Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ function NewsListTimeLine({ query }: Query) {
|
|||||||
<span className="flex items-center gap-1 text-neutral-400/50 ml--1px">
|
<span className="flex items-center gap-1 text-neutral-400/50 ml--1px">
|
||||||
<span className="">-</span>
|
<span className="">-</span>
|
||||||
<span className="text-xs text-neutral-400/80">
|
<span className="text-xs text-neutral-400/80">
|
||||||
{item?.extra?.date && <NewsUpdatedTime date={item.extra.date} />}
|
{(item.pubDate || item.extra?.date) && <NewsUpdatedTime date={item.pubDate || item?.extra?.date} />}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-neutral-400/80">
|
<span className="text-xs text-neutral-400/80">
|
||||||
<ExtraInfo item={item} />
|
<ExtraInfo item={item} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user