rsshub
Version:
Make RSS Great Again!
53 lines (51 loc) • 1.64 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import { t as ViewType } from "./types-D84BRIt4.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./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 { load } from "cheerio";
//#region lib/routes/laohu8/personal.ts
const rootUrl = "https://www.laohu8.com";
const route = {
path: "/personal/:id",
categories: ["finance"],
view: ViewType.Articles,
example: "/laohu8/personal/3527667596890271",
parameters: { id: "用户 ID,见网址链接" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["laohu8.com/personal/:id"] }],
name: "个人主页",
maintainers: ["Fatpandac"],
handler
};
async function handler(ctx) {
const url = `${rootUrl}/personal/${ctx.req.param("id")}`;
const $ = load((await got_default(url)).data);
const author = $("h2.personal-name").text();
const data = JSON.parse($("#__APP_DATA__").text()).tweetList;
const items = await Promise.all(data.map((item) => cache_default.tryGet(item.link, () => ({
title: item.title,
description: String(item.htmlText).replaceAll("\n", "<br><br>"),
link: `${rootUrl}/post/${item.id}`,
pubDate: parseDate(item.gmtCreate)
}))));
return {
title: `老虎社区 - ${author} 个人社区`,
link: url,
item: items
};
}
//#endregion
export { route };