rsshub
Version:
Make RSS Great Again!
58 lines (56 loc) • 1.69 kB
JavaScript
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 { t as parseDate } from "./parse-date-BrP7mxXf.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/pts/curations.ts
init_esm_shims();
const route = {
path: "/curations",
categories: ["traditional-media"],
example: "/pts/curations",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["news.pts.org.tw/curations", "news.pts.org.tw/"] }],
name: "專題策展",
maintainers: ["nczitzk"],
handler,
url: "news.pts.org.tw/curations"
};
async function handler() {
const currentUrl = `https://news.pts.org.tw/curations`;
const $ = load((await got_default({
method: "get",
url: currentUrl
})).data);
const items = $(".project-intro").last().find("h3 a").toArray().map((item) => {
item = $(item);
const projectDiv = item.parent().parent();
return {
title: item.text(),
link: item.attr("href"),
pubDate: parseDate(projectDiv.find("time").text()),
description: art(path.join(__dirname, "templates/description-33e81d41.art"), { image: projectDiv.parent().find(".cover-fit").attr("src") })
};
});
return {
title: $("title").text().replace(/第\d+頁 | /, ""),
link: currentUrl,
item: items
};
}
//#endregion
export { route };