Document document = Jsoup.parse(lines.get()); Elements elements = document.select("#main a"); List<String> links = elements.eachAttr("href");