Stop running DOMPurify on reader server

This commit is contained in:
Tanner Collin 2019-08-24 05:09:02 +00:00
parent c1a81a4d8c
commit 82074eb8aa
2 changed files with 5 additions and 5 deletions

View File

@ -87,3 +87,6 @@ typings/
# DynamoDB Local files # DynamoDB Local files
.dynamodb/ .dynamodb/
# Editor
*.swp
*.swo

View File

@ -17,11 +17,8 @@ const requestCallback = (url, res) => (error, response, body) => {
if (!error && response.statusCode == 200) { if (!error && response.statusCode == 200) {
console.log('Response OK.'); console.log('Response OK.');
const doc = new JSDOM('', {url: url}); const doc = new JSDOM(body, {url: url});
const DOMPurify = createDOMPurify(doc.window); const reader = new Readability(doc.window.document);
const clean = DOMPurify.sanitize(body);
const cleanDoc = new JSDOM(clean, {url: url});
const reader = new Readability(cleanDoc.window.document);
const article = reader.parse(); const article = reader.parse();
if (article && article.content) { if (article && article.content) {