rsshub
Version:
Make RSS Great Again!
65 lines (63 loc) • 2.1 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 parseDate } from "./parse-date-BrP7mxXf.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 { load } from "cheerio";
//#region lib/routes/netflav/index.ts
init_esm_shims();
const route = {
path: "/",
radar: [{
source: ["netflav.com/"],
target: ""
}],
name: "Unknown",
maintainers: ["TonyRL"],
handler,
url: "netflav.com/",
features: { nsfw: true }
};
async function handler() {
const baseUrl = "https://netflav.com";
const { data } = await got_default(baseUrl);
const $ = load(data);
const { head, props: { initialState } } = JSON.parse($("#__NEXT_DATA__").text());
const items = [
...initialState.censored.docs,
...initialState.uncensored.docs,
...initialState.chinese.docs,
...initialState.trending.docs
].map((item) => ({
title: item.title,
description: art(path.join(__dirname, "templates/description-54f95d30.art"), {
description: item.description,
images: [...new Set([
item.preview_hp,
item.preview,
item.previewImagesUrl,
...item.previewImages || []
])].filter(Boolean)
}),
link: `https://netflav.com/video?id=${item.videoId}`,
pubDate: parseDate(item.sourceDate),
author: [...new Set(item.actors.map((a) => a.replace(/^(\w{2}:)/, "")))].join(", "),
category: [...new Set(item.tags?.map((t) => t.replace(/^(\w{2}:)/, "")))]
}));
return {
title: head.find((h) => h[0] === "title")[1].children,
description: head.find((h) => h[0] === "meta" && h[1].name === "description")[1].content,
logo: `${baseUrl}${head.find((h) => h[0] === "meta" && h[1].property === "og:image")[1].content}`,
image: `${baseUrl}${head.find((h) => h[0] === "meta" && h[1].property === "og:image")[1].content}`,
link: baseUrl,
item: items,
allowEmpty: true
};
}
//#endregion
export { route };