Skip to content

Instantly share code, notes, and snippets.

@poctek
Last active July 24, 2016 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poctek/2d61db88732ba8a56a91cea0e48a67c1 to your computer and use it in GitHub Desktop.
Save poctek/2d61db88732ba8a56a91cea0e48a67c1 to your computer and use it in GitHub Desktop.
Script to check my application
require "mechanize"
require "open-uri"
agent = Mechanize.new
page = agent.get("http://abiturient.kpfu.ru/entrant/abit_entrant_originals_list?p_open=&p_faculty=47&p_speciality=375&p_inst=0&p_typeofstudy=1")
table = page.search("body table tr")
result = table.select { |tr| tr.attributes["style"].to_s == "font-weight:bold;"}
puts "Names with originals: "
my_place = 0
result.each_with_index do |tr, index|
td = tr.search("td")
puts "#{td[1].children.text} || #{td[3].children.text}"
my_place = index if td[1].children.text == "Катин Ростислав Максимович"
end
puts "\nTotal applications count: #{table.length - 6}"
puts "Applications with originals count: #{result.length}"
if my_place == 0
puts "I'm still not in list"
else
puts "My place is: #{my_place}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment