Skip to content

Commit

Permalink
allowing scrape to use service account
Browse files Browse the repository at this point in the history
  • Loading branch information
pkage committed Oct 23, 2020
1 parent a09bb9a commit 1afe5de
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions scrape.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ module.exports = async (opts = {}) => {

const members = await nightmare
.goto(`https://www.eusa.ed.ac.uk/organisation/memberlist/${orgID}/?sort=groups`)
.click('.student-login-block')
.wait('#login')
.insert('#login', opts.auth.email)
.click('[value="Continue"]')
.wait('#password')
.insert('#password', opts.auth.password)
.wait('[value="Log in"]')
.click('[value="Log in"]')
.click('.login-block.slider') // service account flow
.wait(1000)
.insert('#ctl00_logincontrol_UserName', opts.auth.email)
.insert('#ctl00_logincontrol_Password', opts.auth.password)
.click('#ctl00_logincontrol_btnLogin')
.wait('.member_list_group')
.evaluate(node_context => {
// executes in browser context
Expand Down Expand Up @@ -96,3 +93,13 @@ module.exports = async (opts = {}) => {
expires: convertFromEUSADate(member.expires)
}))
}
/* // for non-service account flows
.click('.student-login-block')
.wait('#login')
.insert('#login', opts.auth.email)
.click('[value="Continue"]')
.wait('#password')
.insert('#password', opts.auth.password)
.wait('[value="Log in"]')
.click('[value="Log in"]')
*/

0 comments on commit 1afe5de

Please sign in to comment.