Forum Replies Created

  • For seller ratings, you can use Playwright to locate and extract ratings, which are usually displayed alongside the seller’s name or in a span with stars or numeric values. Playwright ensures you wait for the page to load fully before accessing the DOM.

    from playwright.sync_api import sync_playwright
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        page = browser.new_page()
        page.goto('https://www.shoptime.com.br/produto-page')
        # Scrape seller ratings
        seller_rating = page.locator('.seller-rating').inner_text()
        print(f"Seller Rating: {seller_rating}")
        browser.close()
    
  • To extract the price from Extra Brazil, locate the element containing the pricing information, typically within a div or span tag with a class indicating the price. Using Jsoup’s select() method, you can fetch and parse this element.

    import org.jsoup.Jsoup;
    import org.jsoup.nodes.Document;
    import org.jsoup.nodes.Element;
    public class ScrapeExtra {
        public static void main(String[] args) throws Exception {
            // Fetch the product page
            Document doc = Jsoup.connect("https://www.extra.com.br/product-page").get();
            // Extract the product price
            Element price = doc.selectFirst(".product-price");
            System.out.println("Price: " + price.text());
        }
    }