rsshub
Version:
Make RSS Great Again!
64 lines (62 loc) • 1.97 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 { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as parseJSONP } from "./jsonp-helper-C3K8BKW5.mjs";
import path from "node:path";
//#region lib/routes/yoasobi-music/media.ts
init_esm_shims();
const route = {
path: "/media",
categories: ["live"],
example: "/yoasobi-music/media",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["www.yoasobi-music.jp/", "www.yoasobi-music.jp/media"] }],
name: "Media",
maintainers: ["Kiotlin"],
handler,
url: "www.yoasobi-music.jp/"
};
async function handler() {
const api = `https://www.sonymusic.co.jp/json/v2/artist/YOASOBI/media/start/0/count/-1`;
const officialUrl = "https://www.yoasobi-music.jp/media";
const title = "LATEST MEDIA";
const response = await ofetch_default(api);
return {
title,
link: officialUrl,
description: "YOASOBI's Latest Media",
item: Object.values(parseJSONP(response.data).items).flat().toSorted((a, b) => new Date(b.date) - new Date(a.date)).map((item) => ({
date: item.date,
weekDay: item.youbi,
startTime: item.startTime || null,
endTime: item.endTime || null,
tvStation: item.media || null,
title: item.program || item.media,
description: item.note
})).map((i) => ({
title: i.title,
description: art(path.join(__dirname, "templates/media-7d7e1f1f.art"), {
date: i.date,
weekDay: i.weekDay,
postFix: i.startTime && i.endTime && i.tvStation ? `${i.startTime} ~ ${i.endTime} ${i.tvStation}` : null,
description: i.description
}),
pubDate: i.date,
guid: i.title + i.date,
link: officialUrl
}))
};
}
//#endregion
export { route };