UNPKG

rsshub

Version:
70 lines (67 loc) 2.39 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 cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/ekantipur/issue.ts const route = { path: "/:channel?", categories: ["traditional-media"], example: "/ekantipur/news", parameters: { channel: "Find it in the ekantipur.com menu or pick from the list below:" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["ekantipur.com/:channel"], target: "/:channel" }], name: "Full Article RSS", maintainers: ["maniche04"], handler, description: `Channels: | समाचार | अर्थ / वाणिज्य | विचार | खेलकुद | उपत्यका | मनोरञ्जन | फोटोफिचर | फिचर | विश्व | ब्लग | | ---- | -------- | ------- | ------ | -------- | ------------- | -------------- | ------- | ----- | ---- | | news | business | opinion | sports | national | entertainment | photo\_feature | feature | world | blog |` }; async function handler(ctx) { const baseUrl = "https://ekantipur.com"; const { channel = "news" } = ctx.req.param(); const { data: response } = await got_default(`${baseUrl}/${channel}`); const $ = load(response); const list = $("article.normal").toArray().map((item) => { item = $(item); const a = item.find("a").first(); return { title: a.text(), link: `${baseUrl}${a.attr("href")}`, author: item.find("div.author").text(), category: channel }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const { data: response$1 } = await got_default(item.link); const $$1 = load(response$1); $$1("a.static-sponsor").remove(); $$1("div.ekans-wrapper").remove(); item.title = $$1("h1.eng-text-heading").text(); item.description = $$1("div.current-news-block").first().html(); return item; }))); return { title: `Ekantipur - ${channel}`, link: `${baseUrl}/${channel}`, item: items }; } //#endregion export { route };