adding course

average
Matt Huntington 2 years ago
parent f78a90ce34
commit f10c327a2b

@ -14,24 +14,33 @@ const scrapeInstance = async (link, page) => {
const totalStudentsHTML = await totalStudentsElem.getProperty('innerHTML'); const totalStudentsHTML = await totalStudentsElem.getProperty('innerHTML');
const totalStudents = parseInt(await totalStudentsHTML.jsonValue()); const totalStudents = parseInt(await totalStudentsHTML.jsonValue());
const droppedElem = await page.$('.instance-student-detail .dropped'); if(totalStudents > 0){
const droppedHTML = await droppedElem.getProperty('innerHTML');
const dropped = parseInt(await droppedHTML.jsonValue()) const h3elem = await page.$('h3');
const h3HTML = await h3elem.getProperty('innerHTML');
const outcomes90elem = await page.$('.full-time-90-days-actuals') const h3Value = await h3HTML.jsonValue()
const outcomes90HTML = await outcomes90elem.getProperty('innerHTML'); const course = h3Value.match(/(?<=\()[0-9A-Za-z\-]*(?=\))/g)[0]
const outcomes90 = await outcomes90HTML.jsonValue();
const outcomes90Numeric = parseInt(outcomes90.split(' ')[0]) const droppedElem = await page.$('.instance-student-detail .dropped');
const outcomes90Percent = outcomes90.split(' ')[1].replace(/[()]/g, '') const droppedHTML = await droppedElem.getProperty('innerHTML');
const dropped = parseInt(await droppedHTML.jsonValue())
const instanceID = parseInt(page.url().match(/[0-9]*$/g)[0])
const outcomes90elem = await page.$('.full-time-90-days-actuals')
const outcomes90HTML = await outcomes90elem.getProperty('innerHTML');
const outcomes90 = await outcomes90HTML.jsonValue();
const outcomes90Numeric = parseInt(outcomes90.split(' ')[0])
const outcomes90Percent = outcomes90.split(' ')[1].replace(/[()]/g, '')
const graduationElem = await page.$('.course-header__detail') const instanceID = parseInt(page.url().match(/[0-9]*$/g)[0])
const graduationHTML = await graduationElem.getProperty('innerHTML');
const instanceHeaderText = await graduationHTML.jsonValue()
const graduationDate = instanceHeaderText.split(' - ')[1].trim();
console.log({ instanceID, graduationDate, totalStudents, dropped, outcomes90Numeric, outcomes90Percent }); const graduationElem = await page.$('.course-header__detail')
const graduationHTML = await graduationElem.getProperty('innerHTML');
const instanceHeaderText = await graduationHTML.jsonValue()
const graduationDate = instanceHeaderText.split(' - ')[1].trim();
console.log({ instanceID, course, graduationDate, totalStudents, dropped, outcomes90Numeric, outcomes90Percent });
}
return page.goBack(); return page.goBack();
} }

Loading…
Cancel
Save