rsshub
Version:
Make RSS Great Again!
60 lines (59 loc) • 1.66 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/nosetime/comment.ts
const route = {
path: "/:id/:type/:sort?",
categories: ["new-media"],
example: "/nosetime/59247733/discuss/new",
parameters: {
id: "用户id,可在用户主页 URL 中找到",
type: "类型,short 一句话香评 discuss 香评",
sort: "排序, new 最新 agree 最有用"
},
features: { antiCrawler: true },
name: "香评",
maintainers: ["kt286"],
handler
};
async function handler(ctx) {
const { id, type = "discuss", sort = "new" } = ctx.req.param();
const link = `https://www.nosetime.com/member/member_comment.php?id=${id}&type=${type}&o=${sort}`;
const headers = {
Referer: link,
"Content-Type": "application/json;charset=utf-8"
};
const userinfo = await rofetch("https://www.nosetime.com/app/user.php", {
method: "POST",
headers,
responseType: "json",
body: {
method: "getsocialinfo",
id
}
});
const response = await rofetch("https://www.nosetime.com/app/user.php", {
method: "POST",
headers,
responseType: "json",
body: {
method: `getweb${type}`,
id,
orderby: sort,
page: 1
}
});
return {
title: `香水时代 - ${userinfo.uname}`,
link,
description: userinfo.udesc,
item: response.items.map((item) => ({
title: `${"★★★★★☆☆☆☆☆".slice(5 - item.score, 10 - item.score)} ${item.name}`,
description: item.content,
pubDate: parseDate(item.time),
link: `https://www.nosetime.com/xiangshui/${item.id}-${item.iurl}.html`,
author: userinfo.uname
}))
};
}
//#endregion
export { route };