rsshub
Version:
Make RSS Great Again!
64 lines (62 loc) • 2.12 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as timezone } from "./timezone-D8cuwzTY.mjs";
import { c as userUrl, t as appsUrl } from "./utils-CBTVNQEo.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/qoo-app/user/app-comment.ts
init_esm_shims();
const route = {
path: "/user/:lang?/appComment/:uid",
categories: ["anime"],
example: "/qoo-app/user/en/appComment/35399143",
parameters: {
lang: "Language, see the table above, empty means `中文`",
uid: "User ID, can be found in URL"
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "User Game Comments",
maintainers: ["TonyRL"],
handler
};
async function handler(ctx) {
const { uid, lang = "" } = ctx.req.param();
const link = `${userUrl}${lang ? `/${lang}` : ""}/${uid}`;
const { data: response } = await got_default(link);
const { data } = await got_default(`${userUrl}/getUserAppCommentList`, { searchParams: { fid: uid } });
const $ = load(response);
const username = $(".person .name").text();
const items = data.list.map((item) => ({
title: `${username} ▶ ${item.app.name}`,
link: `${appsUrl}/comment-detail/${item.comment.id}`,
description: art(path.join(__dirname, "templates/comment-c10c1815.art"), {
rating: item.score,
text: item.comment.content
}),
pubDate: timezone(parseDate(item.comment.created_at, "YYYY-MM-DD"), 8),
author: username
}));
return {
title: $("head title").text(),
link,
image: decodeURIComponent($(".person div.slot").attr("data-args")).replace("avatar=", "").split("?")[0],
language: $("html").attr("lang"),
item: items
};
}
//#endregion
export { route };