nodejs-web-scraper
Version:
A web scraper for NodeJs
18 lines (14 loc) • 389 B
JavaScript
/**
*
* @param {string} html
* @return {string} clean
*/
function stripTags(html) {//Cleans the html string from script and style tags.
let clean;
clean = html.replace(/<\s*script[^>]*>[\s\S]*?(<\s*\/script[^>]*>|$)/ig, '');
clean = clean.replace(/<style[^>]*>[\s\S]*?(<\/style[^>]*>|$)/ig, '');
return clean;
}
module.exports = {
stripTags
}