rsshub
Version:
Make RSS Great Again!
57 lines (55 loc) • 1.65 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import "./timezone-D8cuwzTY.mjs";
import { r as rootUrl, t as ProcessItems } from "./utils-BSGbkFIV.mjs";
import { load } from "cheerio";
//#region lib/routes/yicai/feed.ts
const route = {
path: "/feed/:id?",
categories: ["traditional-media"],
example: "/yicai/feed/669",
parameters: { id: "主题 id,可在对应主题页中找到,默认为一财早报" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["yicai.com/feed/:id", "yicai.com/feed"],
target: "/feed/:id"
}],
name: "关注",
maintainers: ["nczitzk"],
handler,
description: `::: tip
全部主题词见 [此处](https://www.yicai.com/feed/alltheme)
:::`
};
async function handler(ctx) {
const id = ctx.req.param("id") ?? "669";
const currentUrl = `${rootUrl}/feed/${id}`;
const apiUrl = `${rootUrl}/api/ajax/getlistbytid?id=${id}&page=0&pagesize=${ctx.req.query("limit") ?? 30}`;
const $ = load((await got_default({
method: "get",
url: currentUrl
})).data);
const items = await ProcessItems(apiUrl, cache_default.tryGet);
return {
title: `第一财经主题 - ${$("title").text()}`,
link: currentUrl,
item: items
};
}
//#endregion
export { route };