rsshub
Version:
Make RSS Great Again!
43 lines (41 loc) • 1.39 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 "./timezone-CA9Huotp.mjs";
import { t as utils_default } from "./utils-DEzFZonf.mjs";
//#region lib/routes/lifeweek/channel.ts
const rootApiUrl = "https://www.lifeweek.com.cn/api/userWebFollow/getFollowTagContentList?type=3&sort=2&tagId";
const rootUrl = "https://www.lifeweek.com.cn/column";
const articleRootUrl = "https://www.lifeweek.com.cn/article";
const route = {
path: "/channel/:id",
radar: [{
source: ["lifeweek.com.cn/column/:channel"],
target: "/channel/:channel"
}],
name: "Unknown",
maintainers: [],
handler
};
async function handler(ctx) {
const channel = ctx.req.param("id");
const { data } = await got_default(`${rootApiUrl}=${channel}`);
const result = data.model.articleResponseList;
const items = await Promise.all(result.map((item) => {
const articleLink = `${articleRootUrl}/${item.id}`;
return cache_default.tryGet(articleLink, () => utils_default(item, articleLink));
}));
return {
title: data.model.tagName,
link: `${rootUrl}/${channel}`,
item: items
};
}
//#endregion
export { route };