Skip to content

Instantly share code, notes, and snippets.

@djfpaagman
Created January 19, 2012 14:31
Show Gist options
  • Save djfpaagman/1640299 to your computer and use it in GitHub Desktop.
Save djfpaagman/1640299 to your computer and use it in GitHub Desktop.
SharedCount example script
# encoding: UTF-8
require 'json'
require 'open-uri'
institutes.each do |institute|
begin
sharedcount = JSON(open("http://api.sharedcount.com/?url=http://www.#{institute[:website]}").read)
# Save your data here
rescue OpenURI::HTTPError => the_error
status = the_error.io.status[0]
if status == "500"
next
else
retry
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment