rsshub
Version:
Make RSS Great Again!
63 lines (61 loc) • 1.6 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import "./logger-C4avouvV.mjs";
import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs";
import "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import "./cache-SV6W5EPy.mjs";
import { n as enhanceItemsWithSummaries, r as parseArticles, t as BASE_URL } from "./utils-BewxI9Mf.mjs";
import { load } from "cheerio";
//#region lib/routes/dailypush/tags.ts
const route = {
path: "/tag/:tag/:sort?",
categories: ["programming"],
example: "/dailypush/tag/backend/trending",
parameters: {
tag: { description: "Tag name" },
sort: {
description: "Sort order: `trending` (default) or `latest`",
default: "trending",
options: [{
value: "trending",
label: "Trending"
}, {
value: "latest",
label: "Latest"
}]
}
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: [
"dailypush.dev/:tag/trending",
"dailypush.dev/:tag/latest",
"dailypush.dev/:tag"
],
target: "/tag/:tag/:sort?"
}],
name: "Tag",
maintainers: ["TheGeeKing"],
handler
};
async function handler(ctx) {
const { tag, sort = "trending" } = ctx.req.param();
const url = `${BASE_URL}/${tag}/${sort}`;
const $ = load(await ofetch_default(url));
const items = await enhanceItemsWithSummaries(parseArticles($, BASE_URL));
return {
title: $("title").text() || `DailyPush - ${tag.charAt(0).toUpperCase() + tag.slice(1)}`,
link: url,
item: items
};
}
//#endregion
export { route };