taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

Script tags have no text/inner html #45

Closed TiPPeX2 closed 4 years ago

TiPPeX2 commented 4 years ago

Tried to use this module for extracting some scripts inside HTML response but I cannot.

reproduce

const html_parser = require('node-html-parser')

html_parser.parse('<script>var test = \'\';</script>')
    .querySelectorAll('script')[0].text
TiPPeX2 commented 4 years ago

Use options html_parser.parse('', {script: true}) .querySelectorAll('script')[0].text