-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
240 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default { | ||
// see https://prettier.io/docs/en/options.html | ||
// 优先使用单引号 | ||
singleQuote: false, | ||
// 尾随逗号 | ||
trailingComma: "all", | ||
// 缩进空格数 | ||
tabWidth: 2, | ||
// 使用分号 | ||
semi: true, | ||
// 换行符 | ||
printWidth: 100, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { RouterData } from "../types.js"; | ||
import type { RouterType } from "../router.types.js"; | ||
import { get } from "../utils/getData.js"; | ||
import { getTime } from "../utils/getTime.js"; | ||
|
||
export const handleRoute = async (_: undefined, noCache: boolean) => { | ||
const listData = await getList(noCache); | ||
const routeData: RouterData = { | ||
name: "dgtle", | ||
title: "数字尾巴", | ||
type: "热门文章", | ||
description: | ||
"致力于分享美好数字生活体验,囊括你闻所未闻的最丰富数码资讯,触所未触最抢鲜产品评测,随时随地感受尾巴们各式数字生活精彩图文、摄影感悟、旅行游记、爱物分享。", | ||
link: "https://www.dgtle.com/", | ||
total: listData.data?.length || 0, | ||
...listData, | ||
}; | ||
return routeData; | ||
}; | ||
|
||
const getList = async (noCache: boolean) => { | ||
const url = `https://opser.api.dgtle.com/v2/news/index`; | ||
const result = await get({ url, noCache }); | ||
const list = result.data?.items; | ||
return { | ||
...result, | ||
data: list.map((v: RouterType["dgtle"]) => ({ | ||
id: v.id, | ||
title: v.title || v.content, | ||
desc: v.content, | ||
cover: v.cover, | ||
author: v.from, | ||
hot: v.membernum, | ||
timestamp: getTime(v.created_at), | ||
url: `https://www.dgtle.com/news-${v.id}-${v.type}.html`, | ||
mobileUrl: `https://m.dgtle.com/news-details/${v.id}`, | ||
})), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import type { RouterData, ListContext, Options, RouterResType } from "../types.js"; | ||
import { get } from "../utils/getData.js"; | ||
import { getTime } from "../utils/getTime.js"; | ||
import { parseRSS } from "../utils/parseRSS.js"; | ||
|
||
const areaMap: Record<string, string> = { | ||
china: "中文网", | ||
global: "全球版", | ||
}; | ||
|
||
export const handleRoute = async (c: ListContext, noCache: boolean) => { | ||
const area = c.req.query("type") || "china"; | ||
const listData = await getList({ area }, noCache); | ||
const routeData: RouterData = { | ||
name: "nytimes", | ||
title: "纽约时报", | ||
type: areaMap[area], | ||
params: { | ||
area: { | ||
name: "地区分类", | ||
type: areaMap, | ||
}, | ||
}, | ||
link: "https://www.nytimes.com/", | ||
total: listData?.data?.length || 0, | ||
...listData, | ||
}; | ||
return routeData; | ||
}; | ||
|
||
const getList = async (options: Options, noCache: boolean): Promise<RouterResType> => { | ||
const { area } = options; | ||
const url = | ||
area === "china" | ||
? "https://cn.nytimes.com/rss/" | ||
: "https://rss.nytimes.com/services/xml/rss/nyt/World.xml"; | ||
const result = await get({ | ||
url, | ||
noCache, | ||
headers: { | ||
userAgent: | ||
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36", | ||
}, | ||
}); | ||
const list = await parseRSS(result.data); | ||
return { | ||
...result, | ||
data: list.map((v, i) => ({ | ||
id: v.guid || i, | ||
title: v.title || "", | ||
desc: v.content?.trim() || "", | ||
author: v.author, | ||
timestamp: getTime(v.pubDate || 0), | ||
hot: undefined, | ||
url: v.link || "", | ||
mobileUrl: v.link || "", | ||
})), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { ListContext, Options, RouterData } from "../types.js"; | ||
import type { RouterType } from "../router.types.js"; | ||
import { get } from "../utils/getData.js"; | ||
import { getTime } from "../utils/getTime.js"; | ||
|
||
const typeMap: Record<string, string> = { | ||
"1": "今日热门", | ||
"7": "周热门", | ||
"30": "月热门", | ||
}; | ||
|
||
export const handleRoute = async (c: ListContext, noCache: boolean) => { | ||
const type = c.req.query("type") || "1"; | ||
const listData = await getList({ type }, noCache); | ||
const routeData: RouterData = { | ||
name: "smzdm", | ||
title: "什么值得买", | ||
type: typeMap[type], | ||
description: | ||
"什么值得买是一个中立的、致力于帮助广大网友买到更有性价比网购产品的最热门推荐网站。", | ||
link: "https://www.smzdm.com/top/", | ||
params: { | ||
type: { | ||
name: "文章分类", | ||
type: typeMap, | ||
}, | ||
}, | ||
total: listData.data?.length || 0, | ||
...listData, | ||
}; | ||
return routeData; | ||
}; | ||
|
||
const getList = async (options: Options, noCache: boolean) => { | ||
const { type } = options; | ||
const url = `https://post.smzdm.com/rank/json_more/?unit=${type}`; | ||
const result = await get({ url, noCache }); | ||
const list = result.data.data; | ||
return { | ||
...result, | ||
data: list.map((v: RouterType["smzdm"]) => ({ | ||
id: v.article_id, | ||
title: v.title, | ||
desc: v.content, | ||
cover: v.pic_url, | ||
author: v.nickname, | ||
hot: Number(v.collection_count), | ||
timestamp: getTime(v.time_sort), | ||
url: v.jump_link, | ||
mobileUrl: v.jump_link, | ||
})), | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { RouterData } from "../types.js"; | ||
import type { RouterType } from "../router.types.js"; | ||
import { get } from "../utils/getData.js"; | ||
import { getTime } from "../utils/getTime.js"; | ||
|
||
export const handleRoute = async (_: undefined, noCache: boolean) => { | ||
const listData = await getList(noCache); | ||
const routeData: RouterData = { | ||
name: "yystv", | ||
title: "游研社", | ||
type: "全部文章", | ||
description: | ||
"游研社是以游戏内容为主的新媒体,出品内容包括大量游戏、动漫有关的研究文章和社长聊街机、社长说、游研剧场、老四强等系列视频内容。", | ||
link: "https://www.yystv.cn/docs", | ||
total: listData.data?.length || 0, | ||
...listData, | ||
}; | ||
return routeData; | ||
}; | ||
|
||
const getList = async (noCache: boolean) => { | ||
const url = "https://www.yystv.cn/home/get_home_docs_by_page"; | ||
const result = await get({ url, noCache }); | ||
const list = result.data.data; | ||
return { | ||
...result, | ||
data: list.map((v: RouterType["yystv"]) => ({ | ||
id: v.id, | ||
title: v.title, | ||
cover: v.cover, | ||
author: v.author, | ||
hot: undefined, | ||
timestamp: getTime(v.createtime), | ||
url: `https://www.yystv.cn/p/${v.id}`, | ||
mobileUrl: `https://www.yystv.cn/p/${v.id}`, | ||
})), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters