crawler.io

0.0.4 • Public • Published

node-crawler.io

web crawler i/o

install

npm install crawler.io

example

Simple Usage

var CookieSession = require('crawler.io').CookieSession;
var c = new CookieSession("UserAgent : (I am a Bot.)");
c.get('http://www.yahoo.co.jp/').then(function(res){
    console.log(res)
}).catch(function(err){
    console.log("err")
})

Login Session

var CookieSession = require('crawler.io').CookieSession;
var c = new CookieSession("UserAgent : (I am a Bot.)");

var loginParam = {
    name:process.env['ID'],
    password:process.env['PASS'],
};

c.get('https://www.hatena.ne.jp/').then(function(res){
    return c.post('https://www.hatena.ne.jp/login', loginParam).then(function(res){
        if( res.match(/が違います/) ){
            throw new Error('login error');
        }
        return c.get('http://b.hatena.ne.jp/my')
    }).then(function(res){
        console.log(res)
    })
}).catch(function(err){
    console.log("err")
})

command

ID=username PASS=password node login.js

license

MIT

Readme

Keywords

Package Sidebar

Install

npm i crawler.io

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • you21979