rsshub
Version:
Make RSS Great Again!
41 lines (40 loc) • 1.63 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/chouti/index.ts
const route = {
path: "/:subject?",
categories: ["new-media"],
example: "/chouti/hot",
parameters: { subject: "主题名称" },
name: "最新",
maintainers: ["xyqfer"],
description: `| 热榜 | 42 区 | 段子 | 图片 | 挨踢 1024 | 你问我答 |
| ---- | ----- | ----- | ---- | --------- | -------- |
| hot | news | scoff | pic | tec | ask |`,
handler
};
async function handler(ctx) {
const { subject = "hot" } = ctx.req.param();
const host = "https://m.ichouti.cn";
let api = `${host}/api/m/zone/${subject}?afterTime=0`;
let pageUrl = `https://m.ichouti.cn/zone/${subject}`;
if (subject === "hot") {
api = `${host}/api/m/link/hot?afterTime=0`;
pageUrl = "https://m.ichouti.cn/all/hot";
}
const resultItem = (await rofetch(api)).data.map((item) => ({
title: item.title,
author: item.submitted_user?.nick,
description: `${item.original_img_url || item.img_url ? `<br><img src="${item.original_img_url || item.img_url}">` : ""}<br><a href="${host}/link/${item.id}">评论</a>`,
link: item.url,
pubDate: parseDate(item.created_time / 1e3)
}));
return {
title: "抽屉新热榜",
description: "抽屉新热榜,汇聚每日搞笑段子、热门图片、有趣新闻。它将微博、门户、社区、bbs、社交网站等海量内容聚合在一起,通过用户推荐生成最热榜单。看抽屉新热榜,每日热门、有趣资讯尽收眼底。",
link: pageUrl,
item: resultItem
};
}
//#endregion
export { route };