function getScripts(html) {
    function onopen(name, attrs) {
        // tag should be a <script>
        if (name !== 'script' ||
            // ignore scripts with src attribute
            attrs.src ||
            // script tag should has no type attribute or attribute should be equal to text/javascript
            (attrs.type && attrs.type.toLowerCase() !== 'text/javascript')) {
            return;
        }

        // store script content start pos
        scriptStartPos = parser.endIndex + 1;
    }

    function onclose() {
        if (!scriptStartPos) {
            return;
        }

        // get script content
        var scriptEndPos = parser.startIndex;
        var source = html.substring(scriptStartPos, scriptEndPos);

        // store script content only if it contains non-whitespace characters
        if (rHasNonWhitespace.test(source)) {
            scripts.push({
                source: source,
                start: scriptStartPos,
                end: scriptEndPos
            });
        }

        // reset script start position
        scriptStartPos = 0;
    }

    var scriptStartPos = 0;
    var scripts = [];
    var parser = new htmlparser.Parser({
        onopentag: onopen,
        onclosetag: onclose
    });

    parser.parseComplete(html);

    return scripts;
}
Parse html and retrieve script sources.

@param {String} html
@returns {Object[]}