Created
September 25, 2018 11:43
-
-
Save AnkDos/aba5b45d3f7806aa9ed0ff816ca2b9fd to your computer and use it in GitHub Desktop.
A ruby program to parse AISSCE resullt of a range of roll number.
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
# Created by Ankur (https://github.com/ankdos) | |
require 'mechanize' # Importing the required library | |
mechanize = Mechanize.new # Creating the mechanize instance | |
starting_roll = XXXXXXX # Declaring the range of roll number to be parsed (put a valid roll no) | |
ending_roll = XXXXXXX | |
login_page = mechanize.get 'http://resultsarchives.nic.in/cbseresults/cbseresults2014/class12/cbse122014_total.htm' # The URL to be parsed | |
while starting_roll <= ending_roll | |
form = login_page.forms[0] # Selecting the first form | |
form.field_with(name: 'regno').value = starting_roll # Adding the value to the input box on the webpage | |
page = form.click_button # Clicking the button that shows the result | |
File.open("#{starting_roll}.html", "w") {|f| f.write("#{page.content}") } # Writing Page content in a HTML file | |
starting_roll += 1 | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment