rsshub
Version:
Make RSS Great Again!
56 lines (54 loc) • 1.71 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import { t as ViewType } from "./types-D84BRIt4.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import { t as rss_parser_default } from "./rss-parser-Dtop7M8f.mjs";
import { load } from "cheerio";
//#region lib/routes/gq/news.ts
const host = "https://www.gq.com";
const route = {
path: "/news",
categories: ["traditional-media"],
view: ViewType.Articles,
example: "/gq/news",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["gq.com/"] }],
name: "News",
maintainers: ["EthanWng97"],
handler
};
async function handler() {
const rssUrl = `${host}/feed/rss`;
const feed = await rss_parser_default.parseURL(rssUrl);
return {
title: "GQ",
link: host,
description: `GQ is the global flagship of men's fashion, the arbiter of cool for anyone who sees the world through the lens of taste and style.`,
item: await Promise.all(feed.items.map((item) => cache_default.tryGet(item.link, async () => {
const description = load(await ofetch_default(item.link))("#main-content");
description.find(".article-body__footer").remove();
description.find("[class*=\"ContentHeaderContributorImage\"]").remove();
description.find("h1").remove();
return {
title: item.title,
pubDate: item.pubDate,
link: item.link,
category: item.categories,
description: description.html()
};
})))
};
}
//#endregion
export { route };