티스토리 뷰
Jsoup Ajax 파싱하기
다나와의 메인페이지는 파싱이 되었지만 상품리스트는 Ajax가 작동하기 전 html이었기 때문에 리스트가 파싱되지 않았다.
주소 변수안에 해당 ajax주소를 넣어주고 Origin과 Refere를 설정해준 뒤
query에 해당 상품명을 기입한다. 그리고 post방식으로 전송!
public class JsoupExercise{ private final static String address ="http://search.danawa.com/ajax/getProductList.ajax.php"; public static void main(String[] args) throws IOException{ Document doc = Jsoup.connect(address).header("origin","http://search.danawa.com"). header("Referer", "http://search.danawa.com/dsearch.php").data("query","lg선풍기").post(); System.out.println(doc); } }
'프로그래밍' 카테고리의 다른 글
AES (1) | 2018.01.03 |
---|---|
디버깅 (0) | 2017.12.05 |
블록체인 그냥 읽은거 정리 (0) | 2017.09.22 |
댓글