rsshub
Version:
Make RSS Great Again!
39 lines (38 loc) • 1.08 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 markdownit from "markdown-it";
//#region lib/routes/yinwang/index.ts
const md = markdownit({ html: true });
const route = {
path: "/",
categories: ["blog"],
example: "/yinwang",
name: "文章",
maintainers: ["junbaor", "SkiTiSu"],
handler
};
async function handler() {
const url = "https://www.yinwang.org";
const { posts } = await rofetch(`${url}/api/v1/posts`);
return {
title: "王垠的博客 - 当然我在扯淡",
link: url,
item: await Promise.all(posts.map((post) => {
const link = `${url}/posts/${post.slug}`;
return cache_default.tryGet(link, async () => {
const detail = await rofetch(`${url}/api/v1/posts/${post.slug}`);
return {
title: post.title,
description: md.render(detail.content),
link,
author: "王垠",
category: post.tags,
pubDate: parseDate(post.publish_date)
};
});
}))
};
}
//#endregion
export { route };