Created
January 19, 2012 14:31
-
-
Save dennispaagman/1640299 to your computer and use it in GitHub Desktop.
SharedCount example script
This file contains hidden or 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
# 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