Commit 4c618746 authored by Deokhyun Lee's avatar Deokhyun Lee

added car news

parent 93684ded
Pipeline #2111 failed with stages
......@@ -14,17 +14,17 @@ public class Main{
public static void main(String[] args) throws IOException {
System.out.println("다음 자동차 출력");
Scanner sc = new Scanner(System.in);
System.out.print("검색어: ");
// String str = sc.next();
// String text = URLEncoder.encode(str, "UTF-8");
// String URL = "https://search.naver.com/search.naver?query=" + text + "&where=news&ie=utf8&sm=nws_hty";
String URL = "https://auto.daum.net/news";
Document doc = Jsoup.connect(URL).get();
Elements elem = doc.select("div[class=\"cont_thumb\"]");
Elements trendingNews = doc.select("div[class=\"cont_thumb\"]");
for (Element e : elem) {
System.out.println(e.text());
System.out.println("주요 자동차 뉴스 출력");
for (Element news : trendingNews){
System.out.println(news.text() + "\n");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment