Made spider.js pretty for the cli
This commit is contained in:
parent
14e3bef161
commit
743aada838
1 changed files with 5 additions and 3 deletions
|
|
@ -33,6 +33,7 @@ var scheduletypes = [
|
||||||
* chambers and groups.
|
* chambers and groups.
|
||||||
*/
|
*/
|
||||||
function crawl() {
|
function crawl() {
|
||||||
|
console.log('Starting to crawl the schedule pages for names, student IDs, chambers and teachers');
|
||||||
database.collection('index').drop();
|
database.collection('index').drop();
|
||||||
|
|
||||||
for (scheduletype of scheduletypes) {
|
for (scheduletype of scheduletypes) {
|
||||||
|
|
@ -73,7 +74,7 @@ function rip(page) {
|
||||||
let collection = database.collection('index');
|
let collection = database.collection('index');
|
||||||
|
|
||||||
if (page.type == 'Leerlingrooster') {
|
if (page.type == 'Leerlingrooster') {
|
||||||
|
console.log('\nRipping a studentlist')
|
||||||
for(studentcategory of list) {
|
for(studentcategory of list) {
|
||||||
|
|
||||||
(function (studentcategory) {
|
(function (studentcategory) {
|
||||||
|
|
@ -106,7 +107,7 @@ function rip(page) {
|
||||||
'studentcategory' : studentcategory,
|
'studentcategory' : studentcategory,
|
||||||
'type' : page.type.replace(/rooster/g, '').toLowerCase()
|
'type' : page.type.replace(/rooster/g, '').toLowerCase()
|
||||||
}
|
}
|
||||||
|
process.stdout.write('☐');
|
||||||
collection.insert(databaseEntry);
|
collection.insert(databaseEntry);
|
||||||
|
|
||||||
if (studentcategory == list[list.length - 1] && student == listOfStudents.length - 1) {
|
if (studentcategory == list[list.length - 1] && student == listOfStudents.length - 1) {
|
||||||
|
|
@ -120,12 +121,13 @@ function rip(page) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log('\nRipping a', page.type);
|
||||||
for (entry of list) {
|
for (entry of list) {
|
||||||
let databaseEntry = {
|
let databaseEntry = {
|
||||||
'name' : entry,
|
'name' : entry,
|
||||||
'type' : page.type.replace(/rooster/g, '').toLowerCase()
|
'type' : page.type.replace(/rooster/g, '').toLowerCase()
|
||||||
}
|
}
|
||||||
|
process.stdout.write('☐');
|
||||||
collection.insert(databaseEntry);
|
collection.insert(databaseEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue