Created
October 23, 2011 03:40
-
-
Save clvv/1306841 to your computer and use it in GitHub Desktop.
College Board SAT Score Scraping with Ruby and Mechanize(a quick snippet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
agent = Mechanize.new | |
agent.get 'https://nsat.collegeboard.org/satweb/satHomeAction.action' | |
agent.page.forms[2].username = 'username' | |
agent.page.forms[2].password = 'password' | |
agent.page.forms[2].submit | |
# Second login step if required | |
if agent.page.forms[2] | |
agent.page.forms[2].password = 'password' | |
agent.page.forms[2].submit | |
end | |
# Get list of scores | |
scores = agent.page.search '#myScoreBottom .wrapper' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment