rsshub
Version:
Make RSS Great Again!
37 lines (36 loc) • 1.42 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as config } from "./config-Bpyy15zS.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/bupt/news.ts
const route = {
path: "/news",
categories: ["university"],
example: "/bupt/news",
name: "校园新闻",
maintainers: ["wzekin"],
handler,
features: { requireConfig: [{
name: "BUPT_PORTAL_COOKIE",
description: "登陆 `https://webapp.bupt.edu.cn/wap/login.html?redirect=http://` 后的 Cookie 值"
}] },
description: "由于需要登陆 `https://webapp.bupt.edu.cn/wap/login.html?redirect=http://` 后的 Cookie 值,所以只能自建,详情见部署页面的配置模块"
};
async function handler() {
const cookie = config.bupt.portal_cookie;
const headers = {};
if (cookie) headers.cookie = cookie;
const response = await rofetch("https://webapp.bupt.edu.cn/extensions/wap/news/get-list.html?p=1&type=xnxw", { headers });
return {
title: "北京邮电大学校校园新闻",
link: "https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p=1&type=xnxw",
item: Object.values(response.data).flatMap((value) => value.map((item) => ({
title: item.title,
description: item.desc,
pubDate: parseDate(item.created * 1e3),
link: `https://webapp.bupt.edu.cn/extensions/wap/news/detail.html?id=${item.id}&classify_id=xnxw`,
author: item.author
})))
};
}
//#endregion
export { route };