aboutsummaryrefslogtreecommitdiff
path: root/src/server/lib
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-02-17 17:53:16 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-02-17 17:53:16 +0100
commitcc0fa1b1c1c8211da613ed028143160c6e63724c (patch)
treeb4d90ec72f86082c1953b0f82b33faf71c53234a /src/server/lib
parentf1a408a515505ab1833f2f1c8fe647ee7f2102ee (diff)
Rename parse to scrape
Diffstat (limited to 'src/server/lib')
-rw-r--r--src/server/lib/getMeetingpointData.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/server/lib/getMeetingpointData.js b/src/server/lib/getMeetingpointData.js
index 2e8a6ea..1901972 100644
--- a/src/server/lib/getMeetingpointData.js
+++ b/src/server/lib/getMeetingpointData.js
@@ -10,7 +10,7 @@ const getUrlOfUser = require('./getURLOfUser');
let meetingpointData;
let lastUpdate;
-function parseUsers(page) {
+function scrapeUsers(page) {
const script = page('script').eq(1).text();
const regexs = [/var classes = \[(.+)\];/, /var teachers = \[(.+)\];/, /var rooms = \[(.+)\];/, /var students = \[(.+)\];/];
@@ -43,7 +43,7 @@ function parseUsers(page) {
return _.flatten([classes, teachers, rooms, students]);
}
-function parseWeeks(page) {
+function scrapeWeeks(page) {
const weekSelector = page('select[name="week"]');
const weeks = _.map(weekSelector.children(), option => ({
id: cheerio(option).attr('value'),
@@ -53,7 +53,7 @@ function parseWeeks(page) {
return weeks;
}
-function parseAltText(page) {
+function scrapeAltText(page) {
return page('center > font').eq(2).text().trim();
}
@@ -70,7 +70,7 @@ function getAlts(users) {
const utf8Body = iconv.decode(teacherResponse.body, 'iso-8859-1');
const teacherResponseBody = cheerio.load(utf8Body);
- const teacherName = parseAltText(teacherResponseBody);
+ const teacherName = scrapeAltText(teacherResponseBody);
return {
...users[index],
@@ -90,9 +90,9 @@ function getMeetingpointData() {
const dailySchedulePage = cheerio.load(dailyScheduleResponse.body);
const basisSchedulePage = cheerio.load(basisScheduleResponse.body);
- const users = parseUsers(dailySchedulePage);
- const dailyScheduleWeeks = parseWeeks(dailySchedulePage);
- const basisScheduleWeeks = parseWeeks(basisSchedulePage);
+ const users = scrapeUsers(dailySchedulePage);
+ const dailyScheduleWeeks = scrapeWeeks(dailySchedulePage);
+ const basisScheduleWeeks = scrapeWeeks(basisSchedulePage);
const teachers = users.filter(user => user.type === 't');