rsshub
Version:
Make RSS Great Again!
64 lines (60 loc) • 2.07 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import { t as cache_default } from "./cache-SV6W5EPy.mjs";
import "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { l as processItems, s as fetchData, t as apiArticleRootUrl, u as rootUrl } from "./util-B64gnjsQ.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: true,
supportBT: false,
supportPodcast: true,
supportScihub: false
},
radar: [{ source: ["huxiu.com/article"] }],
name: "资讯",
maintainers: [
"HenryQW",
"nczitzk",
"TimoYoung"
],
handler,
description: `| 视频 | 前沿科技 | 车与出行 | 商业消费 | 社会文化 |
| ---- | -------- | -------- | ---------- | -------- |
| 10 | 105 | 21 | 103 | 106 |
| 金融财经 | 出海 | 国际热点 | 游戏娱乐 | 健康 |
| -------- | ---- | -------- | -------- | ---- |
| 115 | 114 | 107 | 22 | 118 |
| 书影音 | 医疗 | 3C数码 | 观点 | 其他 |
| ------ | ---- | ------ | ---- | ---- |
| 119 | 120 | 121 | 122 | 123 |`,
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/channel/articleListV1`, 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 || "0",
pagesize: limit
} });
return {
item: await processItems(response.data?.dataList ?? response.data.datalist, limit, cache_default.tryGet),
...await fetchData(currentUrl)
};
}
//#endregion
export { route };