rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.22 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { load } from "cheerio";
//#region lib/routes/monsterhunter/update.ts
const route = {
path: "/update",
categories: ["game"],
example: "/monsterhunter/update",
radar: [{ source: ["www.monsterhunter.com/", "www.monsterhunter.com/*path"] }],
name: "更新情报",
maintainers: ["DIYgod"],
handler
};
async function handler() {
const url2 = "https://www.monsterhunter.com/update/mhw/cn/";
const $2 = load(await rofetch(url2));
const list = $2(".panel-list a").toArray().map((element) => {
const $item = $2(element);
return {
title: $item.find("h3").text().trim(),
link: url2 + $item.attr("href")
};
});
return {
title: "怪物猎人世界更新情报",
link: url2,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const $ = load(await rofetch(item.link));
const title = $(".page-ttl").text().trim();
$(".page-ttl").remove();
return {
title: title || item.title,
description: $(".conts").html(),
link: item.link,
author: "MONSTER HUNTER WORLD: ICEBORNE"
};
})))
};
}
//#endregion
export { route };