rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.39 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/moxingfans/index.ts
const route = {
path: "/",
categories: ["other"],
example: "/moxingfans",
name: "新品信息",
maintainers: ["cc798461"],
handler
};
async function handler() {
const baseUrl = "http://www.moxingfans.com/";
const cookie = (await rofetch.raw(`${baseUrl}new`, { ignoreResponseError: true })).headers.getSetCookie().map((c) => c.split(";", 1)[0]).join("; ");
const $ = load(await rofetch(`${baseUrl}new`, { headers: { cookie } }));
return {
title: "静态模型爱好者",
link: baseUrl,
item: await Promise.all($("article").toArray().map((item) => {
const $a = $(item).find("header > h2 > a");
const href = $a.attr("href");
if (!href) return;
const link = new URL(href, baseUrl).href;
const title = $a.text();
return cache_default.tryGet(link, async () => {
const $$ = load(await rofetch(link, { headers: { cookie } }));
return {
title,
description: $$("article.article-content").html(),
link,
pubDate: timezone(parseDate($$("time").text()), 8)
};
});
}).filter((v) => v !== void 0))
};
}
//#endregion
export { route };