Forum Replies Created

  • To scrape delivery options, locate the section that lists shipping costs, times, or options such as express delivery. With Playwright, you can extract this information by targeting the appropriate element and printing its content.

    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 delivery options
        delivery_info = page.locator('.delivery-options').inner_text()
        print(f"Delivery Options: {delivery_info}")
        browser.close()
    
  • For scraping the stock status, you can target the section indicating whether the product is in stock or out of stock. Using Jsoup, fetch the relevant HTML tag and extract its text to display availability.

    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 stock status
            Element stockStatus = doc.selectFirst(".stock-status");
            System.out.println("Stock Status: " + stockStatus.text());
        }
    }