Skip to content

Commit

Permalink
Remove redundant string manipulations
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber623 committed Jun 6, 2023
1 parent facf094 commit c311227
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);

Expand Down

0 comments on commit c311227

Please sign in to comment.