From d5b63d1baab5918055abc1e6be15183c8499aea2 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sun, 7 Jun 2015 22:30:48 +0200 Subject: [PATCH] Removed redundant comments and made the file a module. --- spider.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spider.js b/spider.js index 30f5dc4..c761ae6 100644 --- a/spider.js +++ b/spider.js @@ -1,10 +1,8 @@ -//Import/require modules needed to crawl the schoolmaster schedules. var http = require('http'); var cheerio = require('cheerio'); var iconv = require('iconv-lite'); var mongodb = require('mongodb').MongoClient; -//Define schooltypes that need to be ripped. var scheduletypes = [ 'Klasrooster', 'Docentrooster', @@ -19,9 +17,9 @@ function get(database) { var collection = database.collection('index'); collection.drop(); - //Go past all of the scheduletypes and download their pages. for (scheduletype of scheduletypes) { (function (scheduletype) { + var link = 'http://roosters5.gepro-osi.nl/roosters/rooster.php?school=' + schoolid + '&type=' + scheduletype; scheduletype = scheduletype.replace(/rooster/g, '').toLowerCase(); @@ -109,6 +107,7 @@ function crawl(sid) { }) } +//Redundant function for draining native-mongodb-driver output function showOutput(error, message) { if (process.argv[2] == '-v') { if (error) process.stdout.write(error.toString()); @@ -116,4 +115,6 @@ function showOutput(error, message) { } } -crawl(934); +module.exports = { + 'crawl' : crawl +}