>Node.jsでWEBページのスクレイピングを行う際に必要となる文字コードの変換と、cheerioによってパースしたHTMLをjQueryのように操作できるHTTPクライアントモジュールです。
特徴 : 文字コード自動変換 , jqueryライクなセレクタ , フォーム簡易送信機能
https://www.npmjs.com/package/cheerio-httpcli
npm install cheerio-httpcli
>HTML/XML parser and web scraper for NodeJS.
特徴 : xpathで要素の取得が可能 , Aタグのリンクを自動的に辿れる
https://www.npmjs.com/package/osmosis
マニュアル : https://github.com/rchipka/node-osmosis/wiki
npm install osmosis
【osmosis node.js】で検索した結果のリンクURLをスクレイピングします。
var osmosis = require('osmosis');
var url = 'https://www.google.co.jp/search?client=safari&rls=en&q=osmosis&ie=UTF-8&oe=UTF-8&gfe_rd=cr&ei=JXMyWLv2NOjC8AernaPYAg#q=osmosis+node.js';
osmosis
.get(url)
.paginate("//*[@id='pnnext']",3) // 最大 3ページ目まで
.set({
'link_url' : ["//*[@id='rso']//h3/a/@href"] ,
'link_title': ["//*[@id='rso']//h3/a"] ,
})
.then(function( context, data){
// console.log(context.request);
console.log(data);
})
.done(function(){
console.log("=================================\nscrape done.\n");
});
その他のスクレイピングモジュール : http://blog.webkid.io/nodejs-scraping-libraries/