UNPKG

bb-crawler

Version:

[![NPM version](http://img.shields.io/npm/v/bb-crawler.svg)](https://www.npmjs.com/package/bb-crawler) [![Downloads](https://img.shields.io/npm/dm/bb-crawler.svg)](https://www.npmjs.com/package/bb-crawler)

29 lines (23 loc) 607 B
let {Crawler} = require('../crawler'); const main = async () => { let crawler = new Crawler({ url: `http://www.xbiquge.la/`, async format(ctx){ const html = ctx.res.data; let $= ctx.jquery.load(html); let a = $('a[href]'); let href = []; a.each((i,n)=>{ // console.log(n) href.push($(n).attr('href')); }) return href; } , async store(ctx) { console.log(ctx.data); } }); await crawler.start(); }; main().then(() => { });