java - get src attribute inside div tag jsoup -
i trying parse html getting nullpointor. want extract image uri below html. string html = "<div class=\"thumb-box thumb-160\"><a class=\"mimg\" data-id=\"1394085169856_6744\" href=\"#\"><img class=\"thumb\" src=\"http://i.ytimg.com/vi/u7declndzqw/hqdefault.jpg\" style=\"top: -15px;\"><span class=\"btn\"></span></a></div>"; document document = jsoup.parse(html); element element = document.select("div.thumb-box thumb-160").first(); system.out.println(element.select("img").attr("src")); element element = document.select("div.thumb-box thumb-160").first(); you have use . (dot) every class element element = document.select("div.thumb-box.thumb-160").first(); besides rather straight forward select this element element = document.select("div.thumb-box.thumb-160:eq(0) a").first(...