Skip to content

Instantly share code, notes, and snippets.

@joepie91
Last active March 19, 2018 19:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/aa96bfb6c21704c2819a6067a04dfef6 to your computer and use it in GitHub Desktop.
Save joepie91/aa96bfb6c21704c2819a6067a04dfef6 to your computer and use it in GitHub Desktop.

This is a bit of a hack.

$("noscript").each((i, tag) => {
/* Force the <noscript> tag contents to be interpreted as HTML, as cheerio interprets them as text by default... */
let noScriptContents = $(tag).text();
let parsedNoScriptContents = cheerio.load(noScriptContents);
$(tag).empty().append(parsedNoScriptContents("body").contents());
});
@cthulchu
Copy link

cheerio's noscript issue solution. HTML vs text

@joepie91
Copy link
Author

For future reference: this was tested with cheerio 1.0.0-rc.2.

@joepie91
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment