rsshub
Version:
Make RSS Great Again!
35 lines (33 loc) • 1.23 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.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/thewirehindi/utils.ts
init_esm_shims();
function mapPostToItem(post) {
const featuredMedia = post._embedded?.["wp:featuredmedia"]?.find((v) => v.id === post.featured_media);
const image = featuredMedia?.source_url;
const altText = featuredMedia?.alt_text || featuredMedia?.title?.rendered || "Featured Image";
return {
title: post.title.rendered,
description: art(path.join(__dirname, "templates/description-9104f883.art"), {
excerpt: post.excerpt.rendered,
content: post.content.rendered,
image,
altText
}),
link: post.link,
pubDate: parseDate(post.date_gmt),
updated: parseDate(post.modified_gmt),
itunes_item_image: image,
image,
author: post._embedded?.author?.map((v) => ({
name: v.name,
url: v.link,
avatar: v.avatar_urls?.["96"] || v.avatar_urls?.["48"] || v.avatar_urls?.["24"]
})).join(", ") || "The Wire Hindi",
category: post._embedded?.["wp:term"]?.flat().map((v) => v.name)
};
}
//#endregion
export { mapPostToItem as t };