티스토리 뷰
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.wego.web.test;
import java.util.ArrayList;
import java.util.List;
import org.jsoup.Connection;
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) {
try {
Elements artist = rawData.select("p[class=artist]");
Elements title = rawData.select("p[class=title]");
List<String> artist2 = new ArrayList<>();
List<String> title2 = new ArrayList<>();
for(Element e : artist) {
artist2.add(e.text());
}
for(Element e : title) {
title2.add(e.text());
}
System.out.println(artist2);
System.out.println("---------------");
System.out.println(title2);
} catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
}
}
|
cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package com.wego.web.test; import java.util.ArrayList; import java.util.List; import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Crawler2 { public static void main(String[] args) { try { Document rawData = Jsoup.connect("https://music.bugs.co.kr/recomreview?&order=listorder&page=2").timeout(10*1000).get(); Elements artist = rawData.select("aside[class=recommendReview] p"); List<String> artist2 = new ArrayList<>(); for(Element e : artist) { artist2.add(e.text()); } System.out.println(artist2); } catch (Exception e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } } | cs |
'1. 자바' 카테고리의 다른 글
Txt: is-a 관계와 has-a 관계의 비교 (0) | 2020.05.24 |
---|---|
SpringBoot H2 JDBC 설정 시 주의할 점 @hawaii-boot-mybatis pjt40 (0) | 2020.05.24 |
(자바의정석) 자바> PersonService.java (0) | 2020.05.24 |
Txt: Lambda 5 가지 종류 (0) | 2020.05.24 |
service-array Admin (0) | 2020.05.24 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- COLAB
- Java
- database
- JUnit
- Mlearn
- SQLAlchemy
- Git
- ERD
- React
- JPA
- Eclipse
- SpringBoot
- FLASK
- vscode
- jQuery
- Mongo
- springMVC
- maven
- mariadb
- terms
- intellij
- KAFKA
- Oracle
- nodejs
- Python
- Algorithm
- docker
- AWS
- Django
- tensorflow
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함