简体   繁体   中英

How can I get certain data using Jsoup?

I am websrapping a webpage using Jsoup, but It gives me some info I don't need, Is there a way to use some kind of regex in an element in java?

I get this

< span id="lblRefSellMsg">¢559.41< /span > (avoid the spaces blank spaces between <>)

And the info I need is

559.41

Finally my code looks like this

public class dato {

public static void main(String [] args) throws IOException{
    String tasa = null;
    Document d = Jsoup.connect("http://indi-eco.appspot.com/tcd").timeout(6000).get();
    Elements ele= d.select("span#lblRefSellMsg");
    System.out.print(ele);

ElementElements对象上调用text()方法:

System.out.print(ele.text());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM