티스토리 뷰

node.js 네이버 검색에서 특정 키워드 출현 빈도수 출력해주는 프로그램
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);

 

 

'성형'이라는 키워드 몇개인지 찾아서 출력하는 프로그램

 

end.

 

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함