Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andion
Created December 22, 2010 09:35
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 andion/751314 to your computer and use it in GitHub Desktop.
Save andion/751314 to your computer and use it in GitHub Desktop.
A little script to check spanish christmas lottery numbers on real time checking elpais.com API
#!/usr/bin/env ruby
url = 'http://api.elpais.com/ws/LoteriaNavidadPremiados?n='
urls = {}
if ARGV.any?
ARGV.each do |n|
urls[n] = "#{url}#{n.to_i}"
end
while true
sleep 5
puts "NUMERO\tPREMIO"
urls.each do |n,u|
premio = `curl -s #{u}`.split(',')[1].split(':')[1]
puts "#{n}\t#{premio}"
end
end
else
puts '\nUSAGE: loteria_navidad numero1 [numero2,numero3,...]\n'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment