Skip to content

Instantly share code, notes, and snippets.

@fgiobergia
Created February 18, 2014 14:03
Show Gist options
  • Save fgiobergia/9071562 to your computer and use it in GitHub Desktop.
Save fgiobergia/9071562 to your computer and use it in GitHub Desktop.
Refresh every 60 seconds waiting for some exam's results to be published
require ('uri');
require ('net/https');
headers = {
# Your cookies here
'Cookie' => 'DEV_PORTAL=;OHS-didattica.polito.it-443='
}
uri = URI('https://didattica.polito.it/pls/portal30/sviluppo.esami_da_registrare')
req = Net::HTTP.new(uri.host,uri.port)
req.use_ssl = true
req.verify_mode = OpenSSL::SSL::VERIFY_NONE
while true
req.get(uri.path,headers) do |chunk|
if chunk.match(/Elettrotecnica/) # course name
system 'chromium-browser http://www.youtube.com/watch?v=sXHRR5zAdz0' # action to do
exit
end
end
sleep (60) # time between refreshes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment