rsshub
Version:
Make RSS Great Again!
46 lines (45 loc) • 1.55 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.mjs";
import { t as timezone } from "./timezone-UiMFOuvL.mjs";
import { load } from "cheerio";
//#region lib/routes/qq/mlol/article.ts
const route = {
path: "/mlol/article/:uuid",
categories: ["game"],
example: "/qq/mlol/article/ee97e19c-4a64-4637-b916-b9ee23744d1f",
parameters: { uuid: "用户 UUID,可在文章 html 中获取" },
name: "掌上英雄联盟用户文章",
maintainers: ["ztmzzz"],
handler
};
async function handler(ctx) {
const { uuid } = ctx.req.param();
const url = `https://mlol.qt.qq.com/go/mlol_news/author_feeds?author_uuid=${uuid}`;
const data = (await rofetch(url)).data.feedsInfo;
const name = data[0].feedNews.footer.source;
const items = await Promise.all(data.map((feed) => {
const body = feed.feedNews.body;
const link = `https://mlol.qt.qq.com/go/mlol_news/varcache_article?is_lqt=true&docid=${body.commentID}`;
const item = {
title: body.title,
description: `<img src='${body.imgUrl.split("?", 1)[0]}'>`,
pubDate: timezone(parseDate(body.comCreateDate), 8),
link
};
return cache_default.tryGet(link, async () => {
const detail = await rofetch(link);
const $ = load(detail);
item.description = $(".article_content").html() ?? item.description;
return item;
});
}));
return {
title: `${name}的文章`,
link: url,
description: `${name}的文章`,
item: items
};
}
//#endregion
export { route };