UNPKG

rsshub

Version:
55 lines (53 loc) 1.63 kB
import "./dist-Bog6z_OM.mjs"; import "./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 "./helpers-Bo4JQYdN.mjs"; import "./got-CO-ndVl2.mjs"; import { n as getOriginUrl, t as getArticleDesc } from "./utils-DrTFeQo6.mjs"; import { load } from "cheerio"; //#region lib/routes/jpxgmn/weekly.ts const route = { path: "/weekly", categories: ["picture"], example: "/jpxgmn/weekly", radar: [{ source: ["mei5.vip/"], target: "/weekly" }], name: "本周热门", maintainers: ["Urabartin"], handler, features: { nsfw: true } }; async function handler() { const response = await ofetch_default.raw(await getOriginUrl()); const baseUrl = new URL(response.url).origin; const $ = load(response._data); const items = $("aside div:nth-child(2) li").toArray().map((item) => { const fullTitle = $(item).find("a").attr("title") || ""; const result = fullTitle.match(/([^.]+)\.\D+([\d-]+)/); const ret = { title: fullTitle, link: new URL($(item).find("a").attr("href"), baseUrl).href }; if (result !== null) { ret.title = result[1]; ret.pubDate = parseDate(result[2]); } return ret; }); return { title: `极品性感美女 - 本周热门推荐`, link: response.url, item: await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { item.description = await getArticleDesc(item.link); return item; }))) }; } //#endregion export { route };