UNPKG

rsshub

Version:
65 lines (63 loc) 1.85 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./is-worker-DESPicPc.mjs"; import "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import "./proxy-CjvoY5ys.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import "./puppeteer-9J9JS5H4.mjs"; import "./utils-nNaVjIAm.mjs"; import { t as cache_default } from "./cache-DbIPg7N0.mjs"; //#region lib/routes/bilibili/reply.ts const route = { path: "/video/reply/:bvid", categories: ["social-media"], example: "/bilibili/video/reply/BV1vA411b7ip", parameters: { bvid: "可在视频页 URL 中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "视频评论", maintainers: ["Qixingchen"], handler }; async function handler(ctx) { let bvid = ctx.req.param("bvid"); let aid; if (!bvid.startsWith("BV")) { aid = bvid; bvid = null; } const name = await cache_default.getVideoNameFromId(aid, bvid); if (!aid) aid = await cache_default.getAidFromBvid(bvid); const link = `https://www.bilibili.com/video/${bvid || `av${aid}`}`; const cookie = await cache_default.getCookie(); const data = (await got_default({ method: "get", url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${aid}&sort=0`, headers: { Referer: link, Cookie: cookie } })).data.data.replies; return { title: `${name} 的 评论`, link, description: `${name} 的评论`, item: data.map((item) => ({ title: `${item.member.uname} : ${item.content.message}`, description: `${item.member.uname} : ${item.content.message}`, pubDate: (/* @__PURE__ */ new Date(item.ctime * 1e3)).toUTCString(), link: `${link}/#reply${item.rpid}` })) }; } //#endregion export { route };