From 743aada838aa4b30dc9bffce497821bbc49c94c8 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sat, 18 Jun 2016 15:49:50 +0200 Subject: [PATCH] Made spider.js pretty for the cli --- spider.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spider.js b/spider.js index 95a7752..6dc4b93 100644 --- a/spider.js +++ b/spider.js @@ -33,6 +33,7 @@ var scheduletypes = [ * chambers and groups. */ function crawl() { + console.log('Starting to crawl the schedule pages for names, student IDs, chambers and teachers'); database.collection('index').drop(); for (scheduletype of scheduletypes) { @@ -73,7 +74,7 @@ function rip(page) { let collection = database.collection('index'); if (page.type == 'Leerlingrooster') { - + console.log('\nRipping a studentlist') for(studentcategory of list) { (function (studentcategory) { @@ -106,7 +107,7 @@ function rip(page) { 'studentcategory' : studentcategory, 'type' : page.type.replace(/rooster/g, '').toLowerCase() } - + process.stdout.write('☐'); collection.insert(databaseEntry); if (studentcategory == list[list.length - 1] && student == listOfStudents.length - 1) { @@ -120,12 +121,13 @@ function rip(page) { } } else { + console.log('\nRipping a', page.type); for (entry of list) { let databaseEntry = { 'name' : entry, 'type' : page.type.replace(/rooster/g, '').toLowerCase() } - + process.stdout.write('☐'); collection.insert(databaseEntry); } }