UNPKG

rsshub

Version:
62 lines (60 loc) 1.74 kB
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import path from "node:path"; import { load } from "cheerio"; //#region lib/routes/douban/other/explore.ts init_esm_shims(); const route = { path: "/explore", categories: ["social-media"], example: "/douban/explore", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "浏览发现", maintainers: ["clarkzsd"], handler }; async function handler() { const data = (await got_default({ method: "get", url: "https://www.douban.com/explore" })).data; const $ = load(data); return { title: "豆瓣-浏览发现", link: "https://www.douban.com/explore", item: $("div.item").toArray().map((item) => { item = $(item); const title = item.find(".title a").first().text() ?? "#" + item.find(".icon-topic").text(); const desc = item.find(".content p").text(); const itemPic = item.find("a.cover").attr("style") ? item.find("a.cover").attr("style").match(/\('(.*?)'\)/)[1] : ""; const author = item.find(".usr-pic a").last().text(); const link = item.find(".title a").attr("href") ?? item.find(".icon-topic a").attr("href"); return { title, author, description: art(path.join(__dirname, "templates/explore-03d46c5e.art"), { author, desc, itemPic }), link }; }) }; } //#endregion export { route };