rsshub
Version:
Make RSS Great Again!
56 lines (54 loc) • 1.43 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import { t as config } from "./config-MQ-7ebJ_.mjs";
import "./logger-C4avouvV.mjs";
import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs";
import { t as parseDate } from "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import { t as cache_default } from "./cache-SV6W5EPy.mjs";
import { load } from "cheerio";
//#region lib/routes/gamekee/news.ts
const route = {
path: "/news",
categories: ["game"],
example: "/gamekee/news",
radar: [{
source: ["gamekee.com", "gamekee.com/news"],
target: "/news"
}],
name: "游戏情报",
maintainers: ["ueiu"],
handler,
url: "gamekee.com/news"
};
async function handler() {
const rootUrl = "https://www.gamekee.com";
const { data } = await ofetch_default(`${rootUrl}/v1/index/newsList`, {
headers: {
"game-alias": "www",
"device-num": "1",
"User-Agent": config.ua
},
query: {
page_no: 1,
limit: 20
}
});
const list = data.map((item) => {
return {
link: new URL(`${item.id}.html`, rootUrl).href,
title: item.title,
pubDate: parseDate(item.created_at, "X")
};
});
const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load(await ofetch_default(item.link))("div.content").html();
return item;
})));
return {
link: `${rootUrl}/news`,
title: "游戏情报|Gamekee",
item: items
};
}
//#endregion
export { route };