How to use jssoup - 6 common examples

To help you get started, we’ve selected a few jssoup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arslanmughal5566 / Rocket-SEO / processing / process.js View on Github external
function parseHtml(htmlBody, cb) {
    var soup = new JSSoup(htmlBody);
    // itterate all JSSoup elements array to find interesting tags
    soup.findAll().forEach(function (el) {
        // filters tags with no interest check excluded list at top
        var tag = _.find(excluded_1.default, function (tagName) {
            if (tagName === el.name) {
                return el;
            }
        });
        // concatinating all text in one place
        if (!tag && el.string !== undefined) {
            rawHtmlText += el.text + ' ';
        }
    });
    cb(rawHtmlText.replace(/"|'/g, '').toLowerCase()); // Some Keywords are wraped in "" || '' which will be replace with \s using this RegEx
}
function fromHTMLtoStringArray(siteUrl, isLocal, callback) {
github arslanmughal5566 / Rocket-SEO / processing / process.ts View on Github external
function parseHtml(htmlBody, cb) {
  const soup = new JSSoup(htmlBody);
  // itterate all JSSoup elements array to find interesting tags
  soup.findAll().forEach(el => {
    // filters tags with no interest check excluded list at top
    const tag = _.find(excluded, (tagName) => {
      if (tagName === el.name) { return el; }
    });
    // concatinating all text in one place
    if (!tag && el.string !== undefined) { rawHtmlText += el.text + ' '; }
  });
  cb(rawHtmlText.replace(/"|'/g, '').toLowerCase()); // Some Keywords are wraped in "" || '' which will be replace with \s using this RegEx
}
github TimvanScherpenzeel / detect-gpu / scripts / update_benchmarks.js View on Github external
.then(html => {
        // @ts-ignore
        const soup = new JSSoup(html.replace('', ''));
        const table = soup.find('table');
        const inputs = table.findAll('input');

        const benchmark = inputs.map(input => {
          const score = input.previousElement.text.replace(' ', '').replace('*', '');
          let name = '';

          input.previousElement.contents.forEach(row => {
            if (row.nextElement.text) {
              name = row.nextElement.text;
            }
          });

          return `${score} - ${name}`;
        });
github TimvanScherpenzeel / detect-gpu / scripts / update_benchmarks.js View on Github external
.then((html) => {
      const soup = new JSSoup(html.replace('', ''));
      const table = soup.find('table');
      const inputs = table.findAll('input');

      const benchmark = inputs.map((input) => {
        const score = input.previousElement.text.replace(' ', '').replace('*', '');
        let name = '';

        input.previousElement.contents.forEach((row) => {
          if (row.nextElement.text) {
            name = row.nextElement.text;
          }
        });

        return `${score} - ${name}`;
      });
github fetacore / Infinitex / src / react / Grid.jsx View on Github external
request('http://gen.lib.rus.ec/search.php?&req=' + encodeURIComponent(this.state.paperKeyword) + '&view=detailed&res=100', (err, response, body) => {
      switch (err) {
        case null:
          switch (response.statusCode) {
            case 200:
              let ids = []
              var soup = new JSSoup(body).findAll('table')
              for (var i = 0; i < soup.length; i++) {
                if (soup[i].findAll('td').length == 43) {
                  ids.push(soup[i].findAll('td')[26].contents[0]._text)
                }
                if (i == soup.length - 1) {
                  request({ url: `http://gen.lib.rus.ec/json.php?ids=${ids.join(',')}&fields=*` },
                    (err, response, body) => {
                      switch (err) {
                        case null:
                          switch (response.statusCode) {
                            case 200:
                              this.setState({
                                literatureSearchResults: JSON.parse(body),
                                networkPageIndex: 4,
                                literatureSearchResultsDisplay: true
                              })

jssoup

JSSoup is a BeautifulSoup style HTML parser library.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular jssoup functions