Forum Replies Created

  • To scrape availability from Casas Bahia Brazil, you can extract whether a product is in stock or out of stock. This is often found in a div or span tag that specifies availability status. Using BeautifulSoup, locate and extract this information to determine the product’s availability.

    import requests
    from bs4 import BeautifulSoup
    url = 'https://www.casasbahia.com.br/produto-page'
    response = requests.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')
    availability = soup.find('span', class_='availability-status').text
    print('Availability:', availability)
    
  • To scrape the discount from Submarino Brazil, you can use Cheerio to look for the element containing the discount percentage, which is typically wrapped in a span or div. The discount information may be shown with a percentage off and might appear only if the product is on sale. By querying the relevant HTML element, you can extract the discount value.

    const axios = require('axios');
    const cheerio = require('cheerio');
    async function scrapeDiscount() {
        const { data } = await axios.get('https://www.submarino.com.br/produto-page');
        const $ = cheerio.load(data);
        const discount = $('.discount-percentage').text();
        console.log('Discount:', discount);
    }
    scrapeDiscount();