feat: add source 凤凰网 (#149)
* fix: coolapk fixed #138 * feat: 凤凰网 --------- Co-authored-by: ourongxing <[email protected]>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Vendored
+1
@@ -13,6 +13,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
||||
export const ghxi: typeof import('./sources/ghxi')
|
||||
export const github: typeof import('./sources/github')
|
||||
export const hackernews: typeof import('./sources/hackernews')
|
||||
export const ifeng: typeof import('./sources/ifeng')
|
||||
export const ithome: typeof import('./sources/ithome')
|
||||
export const jin10: typeof import('./sources/jin10')
|
||||
export const juejin: typeof import('./sources/juejin')
|
||||
|
||||
@@ -8,7 +8,7 @@ interface Res {
|
||||
message: string
|
||||
// 起的标题
|
||||
editor_title: string
|
||||
shareUrl: string
|
||||
url: string
|
||||
entityType: string
|
||||
pubDate: string
|
||||
// dayjs(dateline, 'X')
|
||||
@@ -27,10 +27,11 @@ 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],
|
||||
url: i.shareUrl,
|
||||
url: `https://www.coolapk.com${i.url}`,
|
||||
extra: {
|
||||
info: i.targetRow?.subTitle,
|
||||
// date: new Date(i.dateline * 1000).getTime(),
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
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 news: NewsItem[] = []
|
||||
if (match) {
|
||||
const realData = JSON.parse(match[1])
|
||||
realData.hotNews1.forEach((hotNews, i) => {
|
||||
news.push({
|
||||
id: hotNews.url,
|
||||
url: hotNews.url,
|
||||
title: hotNews.title,
|
||||
extra: {
|
||||
hover: hotNews.title,
|
||||
date: hotNews.newsTime,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
return news
|
||||
})
|
||||
+2
-1
@@ -41,5 +41,6 @@
|
||||
"smzdm": "shenmezhidemai",
|
||||
"nowcoder": "niuke",
|
||||
"sspai": "shaoshupai",
|
||||
"juejin": "xitujuejin"
|
||||
"juejin": "xitujuejin",
|
||||
"ifeng": "fenghuangwang"
|
||||
}
|
||||
@@ -371,6 +371,13 @@ export const originSources = {
|
||||
type: "hottest",
|
||||
home: "https://juejin.cn",
|
||||
},
|
||||
"ifeng": {
|
||||
name: "凤凰网",
|
||||
column: "china",
|
||||
color: "red",
|
||||
type: "hottest",
|
||||
home: "https://www.ifeng.com",
|
||||
},
|
||||
} as const satisfies Record<string, OriginSource>
|
||||
|
||||
export function genSources() {
|
||||
|
||||
@@ -466,5 +466,13 @@
|
||||
"home": "https://juejin.cn",
|
||||
"color": "blue",
|
||||
"interval": 600000
|
||||
},
|
||||
"ifeng": {
|
||||
"name": "凤凰网",
|
||||
"type": "hottest",
|
||||
"column": "china",
|
||||
"home": "https://www.ifeng.com",
|
||||
"color": "red",
|
||||
"interval": 600000
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user