feat: add MKTNews as a news source (#185)
This commit is contained in:
Vendored
+1
@@ -22,6 +22,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
||||
export const kaopu: typeof import('./sources/kaopu')
|
||||
export const kuaishou: typeof import('./sources/kuaishou')
|
||||
export const linuxdo: typeof import('./sources/linuxdo')
|
||||
export const mktnews: typeof import('./sources/mktnews')
|
||||
export const nowcoder: typeof import('./sources/nowcoder')
|
||||
export const pcbeta: typeof import('./sources/pcbeta')
|
||||
export const producthunt: typeof import('./sources/producthunt')
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
interface Report {
|
||||
id: string
|
||||
type: number
|
||||
time: string
|
||||
important: number
|
||||
data: {
|
||||
content: string
|
||||
pic: string
|
||||
title: string
|
||||
}
|
||||
remark: string[]
|
||||
hot: boolean
|
||||
hot_start: string
|
||||
hot_end: string
|
||||
classify: {
|
||||
id: number
|
||||
pid: number
|
||||
name: string
|
||||
parent: string
|
||||
}[]
|
||||
}
|
||||
|
||||
interface Child {
|
||||
id: number
|
||||
name: string
|
||||
pid: number
|
||||
flash_list: Report[]
|
||||
}
|
||||
|
||||
interface Res {
|
||||
data: {
|
||||
id: number
|
||||
name: string
|
||||
pid: number
|
||||
child: Child[]
|
||||
}
|
||||
}
|
||||
|
||||
const policy = defineSource(async () => {
|
||||
const res: Res = await myFetch("https://api.mktnews.net/api/flash/host")
|
||||
const flashList = res.data.child.filter(item => item.id === 1000)[0]?.flash_list || []
|
||||
return flashList.map((item) => {
|
||||
const url = `https://mktnews.net/flashDetail.html?id=${item.id}`
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.data.title || item.data.content,
|
||||
url,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const AI = defineSource(async () => {
|
||||
const res: Res = await myFetch("https://api.mktnews.net/api/flash/host")
|
||||
const flashList = res.data.child.filter(item => item.id === 2000)[0]?.flash_list || []
|
||||
return flashList.map((item) => {
|
||||
const url = `https://mktnews.net/flashDetail.html?id=${item.id}`
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.data.title || item.data.content,
|
||||
url,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const financial = defineSource(async () => {
|
||||
const res: Res = await myFetch("https://api.mktnews.net/api/flash/host")
|
||||
const flashList = res.data.child.filter(item => item.id === 3000)[0]?.flash_list || []
|
||||
return flashList.map((item) => {
|
||||
const url = `https://mktnews.net/flashDetail.html?id=${item.id}`
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.data.title || item.data.content,
|
||||
url,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default defineSource({
|
||||
"mktnews": policy,
|
||||
"mktnews-policy": policy,
|
||||
"mktnews-AI": AI,
|
||||
"mktnews-financial": financial,
|
||||
})
|
||||
+4
-1
@@ -45,5 +45,8 @@
|
||||
"juejin": "xitujuejin",
|
||||
"ifeng": "fenghuangwang-redianzixun",
|
||||
"chongbuluo-latest": "chongbuluo-zuixin",
|
||||
"chongbuluo-hot": "chongbuluo-zuire"
|
||||
"chongbuluo-hot": "chongbuluo-zuire",
|
||||
"mktnews-policy": "mkt-xinwen",
|
||||
"mktnews-AI": "mkt-xinwen",
|
||||
"mktnews-financial": "mkt-xinwen"
|
||||
}
|
||||
+46
-19
@@ -57,6 +57,22 @@ export const originSources = {
|
||||
title: "今日最热",
|
||||
home: "https://coolapk.com",
|
||||
},
|
||||
"mktnews": {
|
||||
name: "MKTNews.com",
|
||||
column: "world",
|
||||
home: "https://mktnews.net",
|
||||
sub: {
|
||||
policy: {
|
||||
title: "政策快讯",
|
||||
},
|
||||
AI: {
|
||||
title: "AI快讯",
|
||||
},
|
||||
financial: {
|
||||
title: "金融快讯",
|
||||
},
|
||||
},
|
||||
},
|
||||
"wallstreetcn": {
|
||||
name: "华尔街见闻",
|
||||
color: "blue",
|
||||
@@ -417,29 +433,40 @@ export function genSources() {
|
||||
if (source.sub && Object.keys(source.sub).length) {
|
||||
Object.entries(source.sub).forEach(([subId, subSource], i) => {
|
||||
if (i === 0) {
|
||||
_.push([id, {
|
||||
redirect: `${id}-${subId}`,
|
||||
...parent,
|
||||
...subSource,
|
||||
}] as [any, Source])
|
||||
_.push([
|
||||
id,
|
||||
{
|
||||
redirect: `${id}-${subId}`,
|
||||
...parent,
|
||||
...subSource,
|
||||
},
|
||||
] as [any, Source])
|
||||
}
|
||||
_.push([`${id}-${subId}`, { ...parent, ...subSource }] as [any, Source])
|
||||
_.push([`${id}-${subId}`, { ...parent, ...subSource }] as [
|
||||
any,
|
||||
Source,
|
||||
])
|
||||
})
|
||||
} else {
|
||||
_.push([id, {
|
||||
title: source.title,
|
||||
...parent,
|
||||
}])
|
||||
_.push([
|
||||
id,
|
||||
{
|
||||
title: source.title,
|
||||
...parent,
|
||||
},
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
return typeSafeObjectFromEntries(_.filter(([_, v]) => {
|
||||
if (v.disable === "cf" && process.env.CF_PAGES) {
|
||||
return false
|
||||
} else if (v.disable === true) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}))
|
||||
return typeSafeObjectFromEntries(
|
||||
_.filter(([_, v]) => {
|
||||
if (v.disable === "cf" && process.env.CF_PAGES) {
|
||||
return false
|
||||
} else if (v.disable === true) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -87,6 +87,39 @@
|
||||
"interval": 1800000,
|
||||
"title": "最热文章"
|
||||
},
|
||||
"mktnews": {
|
||||
"redirect": "mktnews-policy",
|
||||
"name": "MKTNews",
|
||||
"column": "world",
|
||||
"home": "https://mktnews.net",
|
||||
"color": "red",
|
||||
"interval": 6000000,
|
||||
"title": "最热文章"
|
||||
},
|
||||
"mktnews-policy": {
|
||||
"name": "MKTNews",
|
||||
"column": "world",
|
||||
"home": "https://mktnews.net",
|
||||
"color": "red",
|
||||
"interval": 6000000,
|
||||
"title": "最热文章"
|
||||
},
|
||||
"mktnews-AI": {
|
||||
"name": "MKTNews",
|
||||
"column": "world",
|
||||
"home": "https://mktnews.net",
|
||||
"color": "red",
|
||||
"interval": 6000000,
|
||||
"title": "AI热点"
|
||||
},
|
||||
"mktnews-financial": {
|
||||
"name": "MKTNews",
|
||||
"column": "world",
|
||||
"home": "https://mktnews.net",
|
||||
"color": "red",
|
||||
"interval": 6000000,
|
||||
"title": "金融热点"
|
||||
},
|
||||
"36kr": {
|
||||
"redirect": "36kr-quick",
|
||||
"name": "36氪",
|
||||
|
||||
Reference in New Issue
Block a user