rsshub
Version:
Make RSS Great Again!
21 lines (20 loc) • 948 B
JavaScript
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/piapro/utils.ts
const parseContent = (htmlString) => {
const $ = load(htmlString);
const title = $("h1.contents_title");
const author = $(".contents_creator_txt");
const time = $(".contents_info").text().match(/\d+\/\d+\/\d+ \d+:\d+:\d+/)[0];
const audioUrl = htmlString.match(/"url":\s*"(https:\/\/cdn\.piapro\.jp\/mp3_a\/[^"]+)"/)?.[1];
const description = ($(".contents_illust_img").html() ?? "") + ($(".contents_description").html() ?? "") + (audioUrl ? `${$(".contents_music_main_jackets_inner").html()}<br><audio src="${audioUrl}" controls loop></audio>` : "") + ($(".contents_text_txt").html() ?? "");
return {
title: title.text(),
author: author.text(),
description,
pubDate: timezone(parseDate(time), 9)
};
};
//#endregion
export { parseContent as t };