본문 바로가기

배우고 있습니다/Node.js 개발10

[Node.js 활용기] 웹크롤링(casperjs/PhantomJS ) for 반복문 안녕하세요. 유헤입니다.오늘은 웹크롤링을 하면서 같은 구간을 반복하거나같은 코드를 반복해야하는 경우 처리 방법에 대해 알려드리고자 합니다. http://docs.casperjs.org/en/latest/modules/casper.html를 참조해보면, repeat() 이라는 함수가 있습니다. casper.start() casper.run() 사이에 반복되는 구간이 있을때 사용하시면 되며, 123456789101112131415161718192021222324252627var cnt=1 casper.repeat(4, function() { casper.then(function(){ var path= ".db_nationset_block > ul > li:nth-child("+cnt+") > a"; cnt+.. 2018. 12. 27.
[Node.js 활용기] 웹크롤링(casperjs/PhantomJS )파일 입 출력 node.js 파일 입출력에 필요한 모듈은 'fs' 입니다 제가 사용한 방법은, 특정 테이블(tr,td) 의 값을 뽑아 파일에 입력하는 기능이였습니다. 123456789for(var i=0; i 2018. 12. 18.
[Node.js 개발일지] Connection lost: The server closed the connection. 에러 처리 안녕하세요. 유헤입니다. Node.js 를 기동하고 ( node example.js 등 ), 일정 시간이 지나면 Connection lost: The server closed the connection. 와 같은 에러를 뜨면서node 가 자동 종료 되는 현상이 있었습니다. Error: Connection lost: The server closed the connection. http://junho85.pe.kr/1151https://code.i-harness.com/ko-kr/q/134635a 사이트를 조사해보니, https://www.npmjs.com/package/mysql 에서 error handling에 대해 언급하고 있다. 2018. 12. 14.
[node.js 활용기] 웹 크롤링 준비 (2) 에러편 이슈 1.Casperjs: can't find variable 'a'https://stackoverflow.com/questions/20870646/casperjs-cant-find-variable-while-jquery-is-injected?rq=1 a 라는 변수가 없다는 것이다. 실제로 console.log("테스트22" + a);로 했는데 a 라는 변수를 설정을 안해뒀다... 이슈 2.casperjs without form로그인 fill 처럼, form 양식이 없어도 데이터를 가져오는 방법 = CSS 선택자 가져오기https://stackoverflow.com/questions/19446232/how-to-fill-up-form-using-casperjs-without-form-tag documen.. 2018. 12. 11.