2.2.0 • Published 7 years ago
spiderbaby v2.2.0
Spiderbaby
Create spiders for Spiderman more efficiently.
Usage
Just require! That's enough.
// your_spider.js
const spider = require('spiderbaby');
API
spider.store
Store data.
let data = {
a: 1,
b: 2
};
spider.store(data);
spider.load
Load data.
let data = await spider.load();
spider.inform
Send a notification
spider.inform({
title: 'Title',
message: 'Message',
url: 'http://example.com'
})
spider.axios
Get an instance of axios
You can use it to make HTTP request which sends cookies automatically.
Example
const axios = spider.axios();
axios.get(...);
axios.post(...);
axios.put(...);
axios.delete(...);
spider.axios.refresh
Get a new instance that clears all cookies.
Example
const a = spider.axios();
const b = spider.axios();
a === b //true
const c = spider.axios.refresh();
a === c; //false
const d = spider.axios();
d === c; //true
spider.cheerio
Get the instance of cheerio.
You can use it as jQuery in node.
Example
const htmlData = '<a>abc</a>';
const $ = spider.cheerio.load(htmlData);
$('a').text(); // abc
LICENSE
MIT