How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • async function load(link, need_feed_description) {
        const response = await got.get(link);
        const $ = cheerio.load(response.data);
        const article = $('.blog_content').removeAttr('style');
        article.find('img').removeAttr('style');
        article
            .find('div')
            // Non-breaking space U+00A0, ` ` in html
            // element.children[0].data === $(element, article).text()
            .filter((_, element) => element.children[0].data === String.fromCharCode(160))
            .remove();
        const description = article.html();
    
        
    
        //...
    }
    
    
    /DIYgod/RSSHub MIT
  • function scrapEntry(uri, authorId, ld, body){
      
      //...
    let $ = cheerio.load(body);
      $ = cheerio.load($('#compo2').html());
    
      entry.title = $('h2').first().text();
      let ratings = $('h3').first().next('p').find('table');
    
      
    
      //...
    }
    
    
    /pjnovas/ldstats bsd-2-clause
  • const $ = cheerio.load(
      '<div class="foo"></div><div data-bar="boo"></div>',
      {
        pseudos: {
          // `:foo` is an alias for `div.foo`
          foo: 'div.foo',
          // `:bar(val)` is equivalent to `[data-bar=val s]`
          bar: (el, val) => el.attribs['data-bar'] === val,
        },
      }
    );
    
    $(':foo').length; // 1
    $('div:bar(boo)').length; // 1
    $('div:bar(baz)').length; // 0
    
    Docs
  • const $ = cheerio.load(
      '<div id=test>\n  <p>Hello</p>\n  <b><p>World</p></b>\n</div>'
    );
    $('#test p').unwrap('b');
    
    //=> <div id=test>
    //     <p>Hello</p>
    //     <p>World</p>
    //   </div>
    
    Docs
  • const $ = cheerio.load(
      '<div class="container"><div class="inner">First</div><div class="inner">Second</div></div>'
    );
    $('.inner').wrapAll("<div class='new'></div>");
    
    //=> <div class="container">
    //     <div class='new'>
    //       <div class="inner">First</div>
    //       <div class="inner">Second</div>
    //     </div>
    //   </div>
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples