UNPKG

rsshub

Version:
60 lines (58 loc) 1.8 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; //#region lib/routes/bilibili/link-news.ts const route = { path: "/link/news/:product", categories: ["social-media"], example: "/bilibili/link/news/live", parameters: { product: "公告分类, 包括 直播:live 小视频:vc 相簿:wh" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "link 公告", maintainers: ["Qixingchen"], handler }; async function handler(ctx) { const product = ctx.req.param("product"); let productTitle = ""; switch (product) { case "live": productTitle = "直播"; break; case "vc": productTitle = "小视频"; break; case "wh": productTitle = "相簿"; break; } const data = (await got_default({ method: "get", url: `https://api.vc.bilibili.com/news/v1/notice/list?platform=pc&product=${product}&category=all&page_no=1&page_size=20`, headers: { Referer: "https://link.bilibili.com/p/eden/news" } })).data.data.items; return { title: `bilibili ${productTitle}公告`, link: `https://link.bilibili.com/p/eden/news#/?tab=${product}&tag=all&page_no=1`, description: `bilibili ${productTitle}公告`, item: data && data.map((item) => ({ title: item.title, description: `${item.mark}<br><img src="${item.cover_url}">`, pubDate: (/* @__PURE__ */ new Date(item.ctime.replace(" ", "T") + "+08:00")).toUTCString(), link: item.announce_link ?? `https://link.bilibili.com/p/eden/news#/newsdetail?id=${item.id}` })) }; } //#endregion export { route };