rsshub
Version:
Make RSS Great Again!
61 lines (57 loc) • 2.19 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 { c as fetchData, d as rootUrl, t as apiArticleRootUrl, u as processItems } from "./util-DaV7o5tf.mjs";
//#region lib/routes/huxiu/channel.ts
const route = {
path: ["/article", "/channel/:id?"],
categories: ["new-media"],
example: "/huxiu/article",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: true,
supportPodcast: true,
supportScihub: false
},
radar: [{ source: ["huxiu.com/article"] }],
name: "资讯",
maintainers: ["HenryQW", "nczitzk"],
handler,
description: `| 视频 | 车与出行 | 年轻一代 | 十亿消费者 | 前沿科技 |
| ---- | -------- | -------- | ---------- | -------- |
| 10 | 21 | 106 | 103 | 105 |
| 财经 | 娱乐淘金 | 医疗健康 | 文化教育 | 出海 |
| ---- | -------- | -------- | -------- | ---- |
| 115 | 22 | 111 | 113 | 114 |
| 金融地产 | 企业服务 | 创业维艰 | 社交通讯 | 全球热点 | 生活腔调 |
| -------- | -------- | -------- | -------- | -------- | -------- |
| 102 | 110 | 2 | 112 | 107 | 4 |`,
url: "huxiu.com/article"
};
async function handler(ctx) {
const id = ctx.req.param("id");
const limit = ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 20;
const apiUrl = new URL(`web/${id ? "channel" : "article"}/articleList`, apiArticleRootUrl).href;
const currentUrl = new URL(id ? `channel/${id}.html` : "article", rootUrl).href;
const { data: response } = await got_default.post(apiUrl, { form: {
platform: "www",
channel_id: id,
pagesize: limit
} });
return {
item: await processItems(response.data?.dataList ?? response.data.datalist, limit, cache_default.tryGet),
...await fetchData(currentUrl)
};
}
//#endregion
export { route };