rsshub
Version:
Make RSS Great Again!
56 lines (54 loc) • 1.75 kB
JavaScript
import "./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 "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import "./timezone-D8cuwzTY.mjs";
import { n as getThread, t as getCookie } from "./common-D6Q6cQeH.mjs";
import { load } from "cheerio";
//#region lib/routes/sis001/author.ts
const route = {
path: "/author/:id?",
categories: ["bbs"],
example: "/sis001/author/13131575",
parameters: { id: "作者 ID,可以在作者的个人空间地址找到" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true
},
name: "作者",
maintainers: ["keocheung"],
handler
};
async function handler(ctx) {
const { id = "13131575" } = ctx.req.param();
const url = `${config.sis001.baseUrl}/forum/space.php?uid=${id}`;
const cookie = await getCookie(url);
const $ = load((await got_default(url, { headers: { cookie } })).data);
const username = $("div.bg div.title").text().replace("的个人空间", "");
let items = $("div.center_subject ul li a[href^=thread]").toArray().map((item) => {
item = $(item);
return {
title: item.text(),
link: `${config.sis001.baseUrl}/forum/${item.attr("href")}`,
author: username
};
});
items = await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => await getThread(cookie, item))));
return {
title: `${username}的主题`,
link: url,
item: items
};
}
//#endregion
export { route };