forked from eugenejade/JavaTPCProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject02_A.java
More file actions
24 lines (24 loc) · 827 Bytes
/
Project02_A.java
File metadata and controls
24 lines (24 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import org.jsoup.Jsoup;
import org.jsoup.nodes.*;
import org.jsoup.select.Elements;
public class Project02_A {
public static void main(String[] args) {
// Jsoup API
String url="https://sports.news.naver.com/wfootball/index.nhn";
Document doc=null;
try {
doc=Jsoup.connect(url).get();
} catch (Exception e) {
e.printStackTrace();
}
Elements element=doc.select("div.home_news");
String title=element.select("h2").text().substring(0, 4);
System.out.println("===============================");
System.out.println(title);
System.out.println("===============================");
for(Element el : element.select("li")) {
System.out.println(el.text());
}
System.out.println("===============================");
}
}