diff --git a/scrape.js b/scrape.js index 0326fd0..7f72c9d 100644 --- a/scrape.js +++ b/scrape.js @@ -50,9 +50,10 @@ const scrapeInstance = async (link, page) => { const graduationHTML = await graduationElem.getProperty('innerHTML'); const instanceHeaderText = await graduationHTML.jsonValue() const graduationDate = instanceHeaderText.split(' - ')[1].trim(); + const startDate = instanceHeaderText.split(' - ')[0].trim().split(':')[1].trim(); - console.log({ instanceID, course, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent }); - const res = await client.query(`INSERT INTO instances (instance_id, course, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`); + console.log({ instanceID, course, startDate, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent }); + const res = await client.query(`INSERT INTO instances (instance_id, course, start_date, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${startDate}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`); } else { await page.screenshot({ path: 'outcomes.png' }) } @@ -76,7 +77,7 @@ const scrapeInstance = async (link, page) => { await delay(500) //wtf await page.type('input[type="text"]', 'matt.huntington@generalassemb.ly'); - await page.type('input[type="password"]', 'Hunt!ngt0n80!'); + await page.type('input[type="password"]', 'Hunt!ngt0n!2'); await page.click('input[type="submit"]'); console.log('entered okta creds'); @@ -124,4 +125,5 @@ const scrapeInstance = async (link, page) => { console.log('done'); //await page.screenshot({ path: 'outcomes.png' }) await browser.close(); + await client.end(); })();