From c311227c1a88f0bfbb1e8b9a561ced8cc8ad28f9 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Mon, 5 Jun 2023 22:16:36 -0400 Subject: [PATCH] Remove redundant string manipulations --- lib/scraper.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/scraper.js b/lib/scraper.js index 5a7c5b2..fbca08b 100755 --- a/lib/scraper.js +++ b/lib/scraper.js @@ -60,15 +60,7 @@ const search_url = `${base_url}/api/2/ubernode/_search?${search_params}`; const image_url = new URL(image.uri.replace('public:/', '/sites/default/files'), base_url); const image_alt = image.alt; - const content = - new TurndownService().turndown( - result - .body - .toString() - .replace(/\n/g, '') - .replace(/\s+/g, ' ') - .trim() - ); + const content = new TurndownService().turndown(result.body.toString()); const data = new Buffer.from(`---json\n${JSON.stringify({ date, title, canonical_url, image_url, image_alt, author }, null, 2)}\n---\n\n${content}\n`);