Commit 93684ded authored by Deokhyun Lee's avatar Deokhyun Lee

자동차 출력 완성

parent 7d95a5eb
Pipeline #2110 canceled with stages
......@@ -12,21 +12,19 @@ import org.jsoup.select.Elements;
public class Main{
public static void main(String[] args) throws IOException {
// 멜로 100 차트
System.out.println("멜론 100 출력");
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 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=\"group_news\"]");
Elements elem = doc.select("div[class=\"cont_thumb\"]");
for (Element e : elem.select("a")) {
if (e.className().equals("news_tit")) {
System.out.println(e.text());
// continue;
}
for (Element e : elem) {
System.out.println(e.text());
}
}
......
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