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

  • 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
  • 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
  • async run(message, args, data) {
        
        //...
    try {
    
          
    
          //...
    let res = await fetch(`https://www.musixmatch.com/search/${songNameFormated}`);
          res = await res.text();
          let $ = await cheerio.load(res);
          const songLink = `https://musixmatch.com${$("h2[class=\"media-card-title\"]").find("a").attr("href")}`;
    
          
    
          //...
    } catch (e) {
          message.error(`No lyrics found for ${songName}`);
        }
      }
    
    /DistroByte/ComfyBot mit
  • const $ = cheerio.load(
      '<span>Span 1</span><strong>Strong</strong><span>Span 2</span>'
    );
    const wrap = $('<div><p><em><b></b></em></p></div>');
    $('span').wrapAll(wrap);
    
    //=> <div>
    //     <p>
    //       <em>
    //         <b>
    //           <span>Span 1</span>
    //           <span>Span 2</span>
    //         </b>
    //       </em>
    //     </p>
    //   </div>
    //   <strong>Strong</strong>
    
    Docs
  • $(element).toggleClass ( className ) // => collection
    // => collection
    $(element).toggleClass ( className, force ) // => collection
    // => collection
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples