package common; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Crawler { public static void main(String[] args) { Crawler crawler = new Crawler(); crawler.getTIOBEs(); } public void getTIOBEs() { String cssQuery = "table"; try { Document doc = Jsoup.connect("https://www.tiobe.com/tiobe-index/").get(); Elements elements = doc.select(cssQuery); System.out.println("가져온 쿼리데이터수는 " + elements.size() + " 개 입니다."); if( elements.size() > 1 ){ for( Element element : elements ){ System.out.println("복수 데이터 테이블 text = " + element.text().substring(0, 30)); System.out.println("복수 데이터 테이블 html = " + element.html().substring(0, 30)); } } else { System.out.println("테이블 text = " + elements.text().substring(0, 30)); System.out.println("테이블 html = " + elements.html().substring(0, 30)); } } catch (IOException e) { e.printStackTrace(); } } }