-
How can I scrape product name, price, stock status from Extra Brazil Java Jsoup?
To scrape the product name from Extra Brazil, you can use Java with the Jsoup library. The product name is often located within an h1 or span tag with a specific class. Using Jsoup’s select() method, you can extract the name after fetching the page.
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 name Element productName = doc.selectFirst("h1.product-title"); System.out.println("Product Name: " + productName.text()); } }
Log in to reply.