rsshub
Version:
Make RSS Great Again!
32 lines (30 loc) • 1.56 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import path from "node:path";
//#region lib/routes/javtrailers/utils.ts
init_esm_shims();
const baseUrl = "https://javtrailers.com";
const headers = { Authorization: "AELAbPQCh_fifd93wMvf_kxMD_fqkUAVf@BVgb2!md@TNW8bUEopFExyGCoKRcZX" };
const hdGallery = (gallery) => gallery.map((item) => {
if (item.startsWith("https://pics.dmm.co.jp/")) return item.replace(/-(\d+)\.jpg$/, "jp-$1.jpg");
else if (item.startsWith("https://image.mgstage.com/")) return item.replace(/cap_t1_/, "cap_e_");
return item;
});
const parseList = (videos) => videos.map((item) => ({
title: `${item.dvdId} ${item.title}`,
link: `${baseUrl}/video/${item.contentId}`,
pubDate: parseDate(item.releaseDate),
contentId: item.contentId
}));
const getItem = async (item) => {
const videoInfo = (await ofetch_default(`${baseUrl}/api/video/${item.contentId}`, { headers })).video;
videoInfo.gallery = hdGallery(videoInfo.gallery);
item.description = art(path.join(__dirname, "templates/description-dded6110.art"), { videoInfo });
item.author = videoInfo.casts.map((cast) => `${cast.name} ${cast.jpName}`).join(", ");
item.category = videoInfo.categories.map((category) => `${category.name}/${category.jpName}/${category.zhName}`);
return item;
};
//#endregion
export { parseList as i, getItem as n, headers as r, baseUrl as t };