rsshub
Version:
Make RSS Great Again!
70 lines (68 loc) • 2.42 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 { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import path from "node:path";
import pMap from "p-map";
//#region lib/routes/zaimanhua/update.ts
init_esm_shims();
const route = {
path: "/update",
categories: ["anime"],
example: "/zaimanhua/update",
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true
},
radar: [{
source: ["manhua.zaimanhua.com/update"],
target: "/update"
}],
name: "最近更新",
maintainers: ["kjasn"],
handler: async () => {
const baseUrl = "https://manhua.zaimanhua.com";
const updateData = (await ofetch_default(`${baseUrl}/api/v1/comic2/update_list?status&theme&zone&cate&firstLetter&sortType&page=1&size=20`, { headers: {
"user-agent": config.trueUA,
referer: baseUrl
} })).data.comicList;
const items = await pMap(updateData, async (item) => {
const comicId = item.id;
const lastUpdateChapterId = item.last_update_chapter_id;
const comicPy = item.comic_py;
const chapterUrl = `${baseUrl}/api/v1/comic2/chapter/detail?comic_id=${comicId}&chapter_id=${lastUpdateChapterId}`;
return await cache_default.tryGet(chapterUrl, async () => {
const chapterData = (await ofetch_default(chapterUrl, { headers: {
"user-agent": config.trueUA,
referer: baseUrl
} })).data;
const description = art(path.join(__dirname, "templates/comic-4d8b7cc7.art"), { contents: chapterData.chapterInfo.page_url || [] });
return {
title: `[${item.status}] | ${item.name} - ${item.last_update_chapter_name}`,
author: item.authors,
category: [item.status, ...item.types.split("/").map((type) => type.trim())],
image: item.cover,
link: `${baseUrl}/view/${comicPy}/${comicId}/${lastUpdateChapterId}`,
pubDate: parseDate(item.last_updatetime * 1e3),
description
};
});
}, { concurrency: 3 });
return {
title: "再漫画 - 最近更新",
link: `${baseUrl}/update`,
item: items
};
}
};
//#endregion
export { route };