I try to get all info contained in div class named : bg_block_info
, but instead i get info for another div class <div class="bg_block_info pad_20">
Why i'm getting it wrong ?
Document doc = Jsoup.connect("http://www.maib.md").get();
Elements myin = doc.getElementsByClass("bg_block_info");
You can combine and chain selectors to refine your query, e.g.:
Document doc = Jsoup.connect("http://www.maib.md/").get(); Elements els = doc.getElementsByClass("bg_block_info").not(".pad_10").not(".pad_20");
That element has two classes (notice the space between bg_block_info
and pad_20
):
<div class="bg_block_info pad_20">
So it does have the class bg_block_info
and your code is working as expected.
Elements downloadLinks = dContent.select("a[href]");
Elements pdfLinks = downloadLinks.select("a[data-format$=pdf]");
Full reference jsoup selector syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With