rsshub
Version:
Make RSS Great Again!
49 lines (48 loc) • 1.59 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/dgtle/whale.ts
const route = {
path: "/whale/category/:category",
categories: ["social-media"],
example: "/dgtle/whale/category/0",
parameters: { category: "分类 id" },
name: "鲸图(分类)",
maintainers: ["Erriy"],
description: `| 精选 | 人物 | 静物 | 二次元 | 黑白 | 自然 | 美食 | 电影与游戏 | 科技与艺术 | 城市与建筑 | 萌物 | 美女 |
| ---- | ---- | ---- | ------ | ---- | ---- | ---- | ---------- | ---------- | ---------- | ---- | ---- |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |`,
handler
};
async function handler(ctx) {
const cid = Number(ctx.req.param("category"));
const categories = [
"精选",
"人物",
"静物",
"二次元",
"黑白",
"自然",
"美食",
"电影与游戏",
"科技与艺术",
"城市与建筑",
"萌物",
"美女"
];
const host = "https://www.dgtle.com";
const items = (await rofetch(`https://opser.api.dgtle.com/v1/whale/index?category_id=${cid}&page=1&per-page=10`)).items.map((item) => ({
title: item.content,
pubDate: parseDate(item.updated_at * 1e3),
author: item.author.username,
description: `<img src=${item.attachment.pic_url.split("?", 1)[0]} />`,
link: item.attachment.pic_url.split("?", 1)[0]
}));
return {
title: `数字尾巴 - 鲸图 - ${categories[cid]}`,
description: "分类鲸图",
link: host,
item: items
};
}
//#endregion
export { route };