rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.46 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/qq/mlol/recommend.ts
const route = {
path: "/mlol/recommend",
categories: ["game"],
example: "/qq/mlol/recommend",
name: "掌上英雄联盟推荐",
maintainers: ["alizeegod"],
handler
};
async function handler() {
const response = await rofetch("https://mlol.qt.qq.com/go/mlol_news/recommend_feeds");
return {
title: "掌上英雄联盟 - 推荐",
link: "https://lol.qq.com/app/index.html",
item: await Promise.all(response.data.feedsInfo.map((feed) => {
const body = feed.feedNews.body;
const link = `https://mlol.qt.qq.com/go/mlol_news/varcache_article?docid=${body.commentID}&gameid=${feed.feedNews.footer.zoneGameId}`;
const item = {
title: body.title,
description: `<img src="${body.imgUrl.split("?", 1)[0]}">`,
pubDate: timezone(parseDate(body.comCreateDate), 8),
link,
author: body.nickName,
guid: body.commentID
};
if (!feed.feedBase.intent.startsWith("https://")) return item;
return cache_default.tryGet(link, async () => {
const $ = load(await rofetch(link));
item.description = $(".article_content").html() ?? item.description;
return item;
});
}))
};
}
//#endregion
export { route };