728x90
node.js pattern matching해서 결과 출력 하는 코드
npm install --save cheerio-httpcli
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var client = require('cheerio-httpcli') let printHttpResponse = (url, callback)=>client.fetch(url, {}, function(err, $, res){ if(err){console.log("error:", err) return } var body = $.html() console.log(body) callback(body) }) let callback_01 = (body)=>{ var re = /성형/g var found = body.match(re) console.log(found) console.log(found.length) } let url = "https://search.naver.com/search.naver?where=post&sm=tab_pge&query=%EC%84%B1%ED%98%95%EC%99%B8%EA%B3%BC&st=sim&date_option=0&date_from=&date_to=&dup_remove=1&post_blogurl=&post_blogurl_without=&srchby=all&nso=&ie=utf8&start=1" printHttpResponse(url, callback_01) | cs |
728x90
'etc > 강의' 카테고리의 다른 글
구글 검색결과 주소 크롤링 코드 (0) | 2017.04.16 |
---|---|
네이버 키워드 검색한 결과에서 제목만 css selector로 뽑아서 엑셀파일 naver.xlsx로 저장하기 (0) | 2017.04.09 |
node.js pattern matching해서 결과 출력 하는 코드 (0) | 2017.04.01 |
크롤링(Crawling)이란? 또는 파싱(Parsing)이란? 스크래핑이란? (0) | 2017.03.30 |
phantomjs, casperjs를 이용해 facebook login해서 크롤링 하기 (13) | 2017.03.13 |
유데미 스프링 프레임웍 동영상 강의를 오픈 했습니다 (0) | 2017.02.28 |