More HTML support

This commit is contained in:
Kuba Orlik 2023-12-09 12:06:27 +01:00
parent afd9f43e28
commit fbf66d9a19

View File

@ -13,7 +13,7 @@ app.use(async (ctx) => {
const { data } = await Axios.get( const { data } = await Axios.get(
"https://podcast.midline.pl/api/v1/channels/Midline/rss" "https://podcast.midline.pl/api/v1/channels/Midline/rss"
); );
const builder = new xml2js.Builder(); const builder = new xml2js.Builder({ cdata: true });
const parsed_data = await xml2js.parseStringPromise(data); const parsed_data = await xml2js.parseStringPromise(data);
parsed_data.rss.channel[0]["itunes:explicit"] = "false"; parsed_data.rss.channel[0]["itunes:explicit"] = "false";
@ -58,10 +58,7 @@ app.use(async (ctx) => {
delete item["guid"][0].$.isPermalink; delete item["guid"][0].$.isPermalink;
item["itunes:subtitle"][0] = trim(item["itunes:subtitle"][0], 255); item["itunes:subtitle"][0] = trim(item["itunes:subtitle"][0], 255);
item["itunes:explicit"][0] = "false"; item["itunes:explicit"][0] = "false";
item["itunes:summary"][0] = item["itunes:summary"][0].replace( item["itunes:summary"][0] = item["itunes:summary"][0];
/(<([^>]+)>)/gi,
""
);
if (item["title"][0].match(/#[0-9]*/)[0].substring(1) !== "0") { if (item["title"][0].match(/#[0-9]*/)[0].substring(1) !== "0") {
try { try {
last_index = item["title"][0] last_index = item["title"][0]