rsshub
Version:
Make RSS Great Again!
67 lines (65 loc) • 1.89 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/zed/blog.ts
const route = {
path: "/blog",
categories: ["programming"],
example: "/zed/blog",
url: "zed.dev",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["zed.dev"],
target: "/blog"
}],
name: "Blog",
maintainers: ["cscnk52"],
handler,
description: "Provides a better reading experience (full articles) over the official ones.",
view: ViewType.Notifications
};
async function handler() {
const feed = await rss_parser_default.parseURL("https://zed.dev/blog.rss");
const items = await Promise.all(feed.items.map((item) => cache_default.tryGet(item.link, async () => {
const article = load(await ofetch_default(item.link))("article");
article.find("style").remove();
article.find("[style]").removeAttr("style");
article.find("[class]").removeAttr("class");
article.find("[id]").removeAttr("id");
article.find("[preload]").removeAttr("preload");
article.find("script").remove();
article.find("figcaption").remove();
article.find("aside").remove();
item.content = article.html();
return {
title: item.title,
link: item.link,
description: item.content,
pubDate: item.pubDate,
author: item.creator
};
})));
return {
title: feed.title,
link: feed.link,
description: feed.description,
item: items,
language: "en"
};
}
//#endregion
export { route };