crawler-ntust-course
v1.0.1
Published
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url] [![Downloads][download-badge]][npm-url]
Downloads
1
Readme
crawler-ntust-course
Install
npm i -D crawler-ntust-course
Usage
This crawer is implementing the Colorgy Course Crawler Spec.
import Crawler from 'crawler-ntust-course';
// Initialize new crawler
var crawler = new Crawler();
crawler.year = 2015;
crawler.term = 1;
// or
crawler = new Crawler({ year: 2015, term: 1 });
// Start crawling, callbacks are provided by promise pattern
crawler.crawl()
.then(function (data) { console.log(data); })
.catch(function (err) { console.error(err); });
// Start crawling and log the progress down
crawler.crawl({ onProgressUpdate: function (progress) { console.log('Progress: ' + progress); } });
// Run a function after new data received
crawler.crawl({ onDataReceived: function (data) { console.dir(data); } });
// Get the crawled data
crawler.getData();
License
MIT © Neson