Test Site

Test Site

  • Docs
  • API
  • Help
  • Blog

›Recent Posts

Recent Posts

  • Getting Start With Cheerio

Getting Start With Cheerio

January 19, 2020

function parseHtml(html) {
  // Load the html in cheerio
  const $ = cheerio.load(html);
  // Load the reviews
  const reviews = $('.review');
  reviews.each((i, review) => {
    // Find the text children
    const textReview = $(review).find('.review-text').text();
    console.log(textReview);
  })
}
request('https://www.amazon.com/dp/B077JP5B5X', function (error, response, body) {
  console.log('error:', error);

 // Print the error if one occurred
  console.log('statusCode:', response && response.statusCode);
 
// Print the response status code if a response was received

  console.log('body:', body);
 // Print the HTML for the Google homepage.
parseHtml(body);


});

Runkit Sample

var getJSON = require("async-get-json");

await getJSON("https://storage.googleapis.com/maps-devrel/google.json");


Recent Posts
Test Site
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2021 Your Name or Your Company Name