UNPKG

rsshub

Version:
38 lines (37 loc) 1.16 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as parseContent } from "./utils-Cf8TxX10.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 listResponse = await rofetch(url); const $ = load(listResponse); 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 () => { const response = await rofetch(link); return { ...parseContent(response), link }; }))); return { title: `piapro - ${username}の投稿作品`, link: url, item: items }; } //#endregion export { route };