rsshub
Version:
Make RSS Great Again!
74 lines (72 loc) • 2.44 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import { t as config } from "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { n as parseRelativeDate } from "./parse-date-BrP7mxXf.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as config_not_found_default } from "./config-not-found-Dyp3RlZZ.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/manhuagui/subscribe.ts
init_esm_shims();
const web_url = "https://www.manhuagui.com/user/book/shelf/1";
const route = {
path: "/subscribe",
categories: ["anime"],
example: "/manhuagui/subscribe",
parameters: {},
features: {
requireConfig: [{
name: "MHGUI_COOKIE",
description: ""
}],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true
},
radar: [{ source: ["www.mhgui.com/user/book/shelf"] }],
name: "漫画个人订阅",
maintainers: ["shininome"],
handler,
url: "www.mhgui.com/user/book/shelf",
description: `::: tip
个人订阅需要自建
环境变量需要添加 MHGUI\_COOKIE
:::`
};
async function handler() {
if (!config.manhuagui || !config.manhuagui.cookie) throw new config_not_found_default("manhuagui RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>");
const cookie = config.manhuagui.cookie;
const $ = load((await got_default({
method: "get",
url: web_url,
headers: { Cookie: cookie }
})).data);
const user_name = $(".avatar-box").find("h3").text();
return {
title: `${user_name} 的 漫画订阅`,
link: web_url,
description: `${user_name} 的 漫画订阅`,
item: $(".dy_content_li").toArray().map((item) => {
const img_src = $(item).find("img").attr("src");
const manga_title = $(item).find(".co_1.c_space").first().text();
return {
title: $(item).find("img").attr("alt"),
link: $(item).find(".co_1.c_space").first().children().attr("href"),
description: art(path.join(__dirname, "templates/manga-af6b398a.art"), {
manga_title,
img_src
}),
pubDate: parseRelativeDate($(item).find(".co_1.c_space").first().next().text())
};
})
};
}
//#endregion
export { route };