0.0.6 • Published 6 years ago
spider-adapters v0.0.6
Spider Adapters
🕷️ Adapter for spiders, using Cheerio to parse HTML response.
[中文版] | NPM
How to install?
npm i spider-adaptersHow to use?
//My testing code in test/index.js
const adapters = require('spider-adapters');
let links = [
'https://github.com/trending/',
];
links.map(async link => {
let data = await adapters.deal(link);
console.log(data);
});Or simply use it as:
let source = 'https://github.com/trending/';
let data = require('spider-adapters').deal(link)List for existing adapters:
- Github Trending
- PPMSG
- Yandere List & Detail
- CNBeta
How to create your own one?
Add a file (any name is acceptable), in /adapter/ folder. Define its name and pattern, then define a handler function. Pass these to Adapter class, then you got it.