rsshub
Version:
Make RSS Great Again!
43 lines (42 loc) • 1.58 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";
//#region lib/routes/dgtle/index.ts
const route = {
path: "/",
categories: ["social-media"],
example: "/dgtle",
name: "首页",
maintainers: ["Erriy"],
handler
};
async function handler() {
const articleItems = (await rofetch("https://www.dgtle.com/home/getItemsList", { query: {
page: 1,
adv_flag: 0,
left_type: "",
last_id: 0
} })).data.dataList.flat().filter((item) => item.type === 1 || item.type === 4);
return {
title: "数字尾巴 - 首页",
link: "https://www.dgtle.com",
description: "数字尾巴首页内容",
item: await Promise.all(articleItems.map(async (item) => {
const isArticle = item.type === 1;
const dlink = isArticle ? `https://opser.api.dgtle.com/v1/article/view/${item.aid}` : `https://opser.api.dgtle.com/v1/feeds/inst/${item.aid}`;
return await cache_default.tryGet(dlink, async () => {
const detail = await rofetch(dlink);
return {
title: isArticle ? item.title : item.summary,
description: isArticle ? detail.content : detail.content + detail.imgs_url.map((dimg) => `<img src="${dimg.path.split("?", 1)[0]}">`).join(""),
pubDate: parseDate(item.send_at * 1e3),
link: isArticle ? `https://www.dgtle.com/article-${item.aid}-1.html` : `https://www.dgtle.com/inst-${item.aid}-1.html`,
category: isArticle ? "文章" : "兴趣动态",
author: item.user_name
};
});
}))
};
}
//#endregion
export { route };