chore: minor changes
This commit is contained in:
@@ -7,7 +7,7 @@ export default defineSource(async () => {
|
||||
const response = await $fetch(url)
|
||||
const $ = load(response)
|
||||
const news: NewsItem[] = []
|
||||
const $items = $(".news-list-item")
|
||||
const $items = $(".newsflash-item")
|
||||
$items.each((_, el) => {
|
||||
const $el = $(el)
|
||||
const $a = $el.find("a")
|
||||
|
||||
@@ -7,6 +7,8 @@ import zhihu from "./zhihu"
|
||||
import cankaoxiaoxi from "./cankaoxiaoxi"
|
||||
import coolapk from "./coolapk"
|
||||
import sputniknewscn from "./sputniknewscn"
|
||||
import kr from "./36kr"
|
||||
import wallstreetcn from "./wallstreetcn"
|
||||
|
||||
export const sourcesFn = {
|
||||
weibo,
|
||||
@@ -17,8 +19,8 @@ export const sourcesFn = {
|
||||
coolapk,
|
||||
cankaoxiaoxi,
|
||||
sputniknewscn,
|
||||
wallstreetcn,
|
||||
"douyin": defineFallbackSource("douyin"),
|
||||
"toutiao": defineFallbackSource("toutiao"),
|
||||
"wallstreetcn": defineRSSHubSource("/wallstreetcn/live"),
|
||||
"36kr-quick": defineRSSHubSource("/36kr/newsflashes"),
|
||||
"36kr-quick": kr,
|
||||
} as Record<SourceID, () => Promise<NewsItem[]>>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
interface Res {
|
||||
data: {
|
||||
items: {
|
||||
uri: string
|
||||
id: number
|
||||
title?: string
|
||||
content_text: string
|
||||
display_time: number
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/DIYgod/RSSHub/blob/master/lib/routes/wallstreetcn/live.ts
|
||||
export default defineSource(async () => {
|
||||
const category = "global"
|
||||
const apiRootUrl = "https://api-one.wallstcn.com"
|
||||
const apiUrl = `${apiRootUrl}/apiv1/content/lives?channel=${category}-channel&limit=30`
|
||||
|
||||
const res: Res = await $fetch(apiUrl)
|
||||
if (!res?.data?.items || res.data.items.length === 0) throw new Error("Cannot fetch data")
|
||||
return res.data.items
|
||||
.slice(0, 20)
|
||||
.map((k) => {
|
||||
return {
|
||||
id: k.id,
|
||||
title: k.title || k.content_text,
|
||||
extra: {
|
||||
date: new Date(k.display_time * 1000).getTime(),
|
||||
},
|
||||
url: k.uri,
|
||||
}
|
||||
})
|
||||
})
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const TTL = 30 * 60 * 1000
|
||||
/**
|
||||
* 默认刷新间隔
|
||||
* 默认刷新间隔, 10 min
|
||||
*/
|
||||
export const Interval = 10 * 60 * 1000
|
||||
|
||||
+12
-6
@@ -1,10 +1,14 @@
|
||||
import { Interval } from "./consts"
|
||||
import { typeSafeObjectFromEntries } from "./type.util"
|
||||
import type { OriginSource, Source, SourceID } from "./types"
|
||||
|
||||
const Time = {
|
||||
test: 1,
|
||||
half: 30 * 60 * 1000,
|
||||
five: 5 * 60 * 1000,
|
||||
Test: 1,
|
||||
Realtime: 2 * 60 * 1000,
|
||||
Fast: 5 * 60 * 1000,
|
||||
Default: Interval, // 10min
|
||||
Common: 30 * 60 * 1000,
|
||||
Slow: 60 * 60 * 1000,
|
||||
}
|
||||
|
||||
export const originSources = {
|
||||
@@ -18,6 +22,7 @@ export const originSources = {
|
||||
},
|
||||
"wallstreetcn": {
|
||||
name: "华尔街见闻",
|
||||
interval: Time.Fast,
|
||||
home: "https://wallstreetcn.com/",
|
||||
title: "快讯",
|
||||
},
|
||||
@@ -27,7 +32,7 @@ export const originSources = {
|
||||
},
|
||||
"cankaoxiaoxi": {
|
||||
name: "参考消息",
|
||||
interval: Time.half,
|
||||
interval: Time.Common,
|
||||
home: "https://china.cankaoxiaoxi.com",
|
||||
},
|
||||
"36kr": {
|
||||
@@ -54,7 +59,7 @@ export const originSources = {
|
||||
"weibo": {
|
||||
name: "微博",
|
||||
title: "实时热搜",
|
||||
interval: 5 * 60 * 1000,
|
||||
interval: Time.Realtime,
|
||||
home: "https://weibo.com",
|
||||
},
|
||||
"tieba": {
|
||||
@@ -63,11 +68,12 @@ export const originSources = {
|
||||
},
|
||||
"zaobao": {
|
||||
name: "联合早报",
|
||||
interval: Time.Common,
|
||||
home: "https://www.zaobao.com",
|
||||
},
|
||||
"thepaper": {
|
||||
name: "澎湃新闻",
|
||||
interval: Time.half,
|
||||
interval: Time.Common,
|
||||
home: "https://www.thepaper.cn",
|
||||
},
|
||||
"toutiao": {
|
||||
|
||||
Reference in New Issue
Block a user