Convert HTML entities, codes and tag (#3191)

related to PR [#3092](https://github.com/MichMich/MagicMirror/pull/3092)

maybe best way is using `html-to-text` library

sample: `&quotHello World&quot` will be transformed to `"Hello World"`
This commit is contained in:
Bugsounet - Cédric
2023-09-13 22:47:07 +02:00
committed by GitHub
parent 7a1591b2d6
commit 91fd931a58
4 changed files with 141 additions and 48 deletions

View File

@@ -8,6 +8,7 @@
const stream = require("stream");
const FeedMe = require("feedme");
const iconv = require("iconv-lite");
const { htmlToText } = require("html-to-text");
const Log = require("logger");
const NodeHelper = require("node_helper");
@@ -53,6 +54,8 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
if (title && pubdate) {
const regex = /(<([^>]+)>)/gi;
description = description.toString().replace(regex, "");
// Convert HTML entities, codes and tag
description = htmlToText(description, { wordwrap: false });
items.push({
title: title,