rsshub
Version:
Make RSS Great Again!
82 lines (80 loc) • 2.32 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./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 art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import dayjs from "dayjs";
//#region lib/routes/guduodata/daily.ts
init_esm_shims();
const host = "http://d.guduodata.com";
const types = {
collect: {
name: "汇总榜",
categories: {
drama: "连续剧",
variety: "综艺"
}
},
bill: {
name: "排行榜",
categories: {
network_drama: "网络剧",
network_movie: "网络大电影",
network_variety: "网络综艺",
tv_drama: "电视剧",
tv_variety: "电视综艺",
anime: "国漫"
}
}
};
const route = {
path: "/daily",
categories: ["other"],
example: "/guduodata/daily",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["guduodata.com/"] }],
name: "日榜",
maintainers: ["Gem1ni"],
handler,
url: "guduodata.com/"
};
async function handler() {
const now = dayjs().valueOf();
const yestoday = dayjs().subtract(1, "day").format("YYYY-MM-DD");
const renderRows = (rows) => art(path.join(__dirname, "templates/daily-2191cf36.art"), { rows });
const items = Object.keys(types).flatMap((key) => Object.keys(types[key].categories).map((category) => ({
type: key,
name: `[${yestoday}] ${types[key].name} - ${types[key].categories[category]}`,
category: category.toUpperCase(),
url: `${host}/m/v3/billboard/list?type=DAILY&category=${category.toUpperCase()}&date=${yestoday}`
})));
return {
title: `骨朵数据 - 日榜`,
link: host,
description: yestoday,
item: await Promise.all(items.map((item) => cache_default.tryGet(item.url, async () => {
const data = (await got_default.get(`${item.url}&t=${now}`, { headers: { Referer: `http://guduodata.com/` } })).data.data;
return {
title: item.name,
pubDate: yestoday,
link: item.url,
description: renderRows(data)
};
})))
};
}
//#endregion
export { route };