rsshub
Version:
Make RSS Great Again!
60 lines (58 loc) • 1.74 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import markdownit from "markdown-it";
//#region lib/routes/deadbydaylight/index.ts
const md = markdownit({
html: true,
linkify: true
});
const baseUrl = "https://deadbydaylight.com";
const route = {
path: "/blog",
categories: ["game"],
example: "/deadbydaylight/blog",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["deadbydaylight.com/news"],
target: "/news"
}],
name: "Latest News",
maintainers: ["NeverBehave"],
handler
};
async function handler() {
const articleMeta = (await ofetch_default(`${baseUrl}/page-data/news/page-data.json`)).result.pageContext.postsData.articles.edges;
return {
title: "Latest News",
link: "https://deadbydaylight.com/news",
item: await Promise.all(Object.keys(articleMeta).map((id) => {
const dataUrl = `${baseUrl}/page-data/news/${articleMeta[id].node.slug}/page-data.json`;
return cache_default.tryGet(dataUrl, async () => {
const articleData = await ofetch_default(dataUrl);
const pageData = articleData.result.data.pageData;
return {
title: pageData.title,
link: `${baseUrl}${articleData.path}`,
description: md.render(pageData.content),
pubDate: parseDate(pageData.published_at),
category: pageData.article_category.name
};
});
}))
};
}
//#endregion
export { route };