Code:

doc2 = Jsoup.connect("https://www.layta.ru/rvi-ipc31ms-ir.html").get(); Element priceElement = doc.select("span.price").get(0); float price = Float.parseFloat(priceElement.text().substring(0, priceElement.text().lastIndexOf(" ")).replaceAll(" ", "")); System.out.println("!X "+price); 

For some reason, it returns the number 11042. It should be 6600.

What could be the error?

  • What exactly is there to guess? - Qwertiy

1 answer 1

The error is that you parse the wrong document.

Replace doc with doc2 in the second line, then the desired 6600.0 will be displayed.

  • Hmm, shame on me!)) - Michael