UNPKG

rsshub

Version:
64 lines (62 loc) 2.01 kB
import "./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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; import pMap from "p-map"; //#region lib/routes/shoppingdesign/posts.ts const route = { path: "/posts", categories: ["design"], example: "/shoppingdesign/posts", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.shoppingdesign.com.tw/post"] }], name: "文章列表", maintainers: ["miles170"], handler, url: "www.shoppingdesign.com.tw/post" }; async function handler() { const currentUrl = "https://www.shoppingdesign.com.tw/post?sn_f=1"; const $ = load((await got_default(currentUrl)).data); const items = await pMap($("article-item").toArray(), (item) => { item = $(item); const link = item.attr("url"); return cache_default.tryGet(link, async () => { const $$1 = load((await got_default(`${link}?sn_f=1`)).data); const article = $$1(".left article .htmlview"); article.find("d-image").each(function() { $$1(this).replaceWith(`<img src="${$$1(this).attr("lg")}">`); }); return { title: $$1(".left article .top_info h1").text(), author: $$1("meta[name=\"my:author\"]").attr("content"), description: article.html(), category: $$1("meta[name=\"my:category\"]").attr("content"), pubDate: parseDate($$1("meta[name=\"my:publish\"]").attr("content")), link }; }); }, { concurrency: 10 }); return { title: $("meta[property=\"og:title\"]").attr("content"), link: currentUrl, description: $("meta[property=\"og:description\"]").attr("content"), item: items }; } //#endregion export { route };