UNPKG

rsshub

Version:
36 lines (35 loc) 1.09 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { t as parseContent } from "./utils--zTDY5Nh.mjs"; import { load } from "cheerio"; //#region lib/routes/piapro/user.ts const base = "https://piapro.jp"; const route = { path: "/user/:pid", categories: ["social-media"], example: "/piapro/user/shine_longer", parameters: { pid: "User ID, can be found in url" }, name: "User latest works", maintainers: ["hoilc"], handler }; async function handler(ctx) { const { pid } = ctx.req.param(); const url = `${base}/${pid}/content_list/all/1`; const $ = load(await rofetch(url)); const username = $(".page_back_txt").text(); const list = $(".tmblist_list li > a").toArray().map((item) => base + $(item).attr("href")); const items = await Promise.all(list.slice(0, 10).map((link) => cache_default.tryGet(link, async () => { return { ...parseContent(await rofetch(link)), link }; }))); return { title: `piapro - ${username}の投稿作品`, link: url, item: items }; } //#endregion export { route };