rsshub
Version:
Make RSS Great Again!
60 lines (58 loc) • 2.15 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as rss_parser_default } from "./rss-parser-Dtop7M8f.mjs";
import { load } from "cheerio";
//#region lib/routes/ft/myft.ts
const route = {
path: "/myft/:key",
categories: ["traditional-media"],
example: "/ft/myft/rss-key",
parameters: { key: "the last part of myFT personal RSS address" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "myFT personal RSS",
maintainers: ["HenryQW"],
handler,
description: `::: tip
- Visit ft.com -> myFT -> Contact Preferences to enable personal RSS feed, see [help.ft.com](https://help.ft.com/faq/email-alerts-and-contact-preferences/what-is-myft-rss-feed/)
- Obtain the key from the personal RSS address, it looks like \`12345678-abcd-4036-82db-vdv20db024b8\`
:::`
};
async function handler(ctx) {
const ProcessFeed = (content) => {
content.find("div.o-share, aside, div.o-ads").remove();
return content.html();
};
const link = `https://www.ft.com/myft/following/${ctx.req.param("key")}.rss`;
const feed = await rss_parser_default.parseURL(link);
return {
title: `FT.com - myFT`,
link,
description: `FT.com - myFT`,
item: await Promise.all(feed.items.map((item) => cache_default.tryGet(item.link, async () => {
const $ = load((await got_default({
method: "get",
url: item.link,
headers: { Referer: "https://www.facebook.com" }
})).data);
item.description = ProcessFeed($("article.js-article__content-body"));
item.category = [$(".n-content-tag--with-follow").text(), ...$(".article__right-bottom a.concept-list__concept").toArray().map((e) => $(e).text().trim())];
item.author = $("a.n-content-tag--author").toArray().map((e) => ({ name: $(e).text() }));
return item;
})))
};
}
//#endregion
export { route };