Forum Replies Created

  • To gather customer reviews, identify the section of the page where reviews are listed, typically within div tags with specific classes. Iterate through these elements to extract individual reviews, capturing the review text and any associated metadata such as ratings.

    require 'net/http'
    require 'nokogiri'
    # Fetch the product page
    url = URI('https://www.magazineluiza.com.br/produto-page')
    response = Net::HTTP.get(url)
    # Parse the HTML
    doc = Nokogiri::HTML(response)
    # Extract customer reviews
    reviews = doc.css('.customer-review')
    reviews.each do |review|
      review_text = review.at_css('.review-text').text.strip
      rating = review.at_css('.review-rating').text.strip
      puts "Review: #{review_text} (Rating: #{rating})"
    end
    
  • To scrape shipping details from Submarino Brazil, use Cheerio to find the shipping section of the page. The shipping information, including estimated delivery times and shipping fees, is usually contained in a specific div or span. Extract this information by selecting the appropriate class or tag that holds the shipping text.

    const axios = require('axios');
    const cheerio = require('cheerio');
    async function scrapeShipping() {
        const { data } = await axios.get('https://www.submarino.com.br/produto-page');
        const $ = cheerio.load(data);
        const shipping = $('.shipping-info').text();
        console.log('Shipping Details:', shipping);
    }
    scrapeShipping();