UNPKG

rsshub

Version:
30 lines (29 loc) 1.09 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as getData } from "./utils-gGwns_tt.mjs"; import { load } from "cheerio"; //#region lib/routes/letterboxd/followingdiary.ts const route = { path: "/user/followingdiary/:username", categories: ["new-media"], example: "/letterboxd/user/followingdiary/demiadejuyigbe", parameters: { username: "username" }, name: "Following diary", maintainers: ["loganrockmore"], handler }; async function handler(ctx) { const { username } = ctx.req.param(); const url = `https://letterboxd.com/${username}/following/`; const title = `Letterboxd - following diary - ${username}`; const $ = load(await rofetch(url, { headers: { Referer: url } })); const users = $(".person-summary .title-3 a").toArray().map((user) => $(user).attr("href")); const usersResult = await Promise.all(users.map((user) => getData(user.replaceAll("/", ""), title))); return { title, link: url, description: $("meta[name=\"description\"]").attr("content"), item: usersResult.flatMap((result) => result.item) }; } //#endregion export { route };