Had to see what pages on a wordpress site had shares/likes. Whipped this out real quick. With more futzing around with the api you can differentiate between likes/shares/comments.
Thought you might like to run it against some of your sites. Enjoy.
Thought you might like to run it against some of your sites. Enjoy.
Code:
#!/opt/local/bin/ruby
require 'rubygems'
require 'json'
require 'open-uri'
require 'hpricot'
# get urls
sitemap = open(ARGV[0]).read
doc = Hpricot(sitemap)
(doc/'loc').each do |url|
deep = url.inner_html
puts deep
content = open("http://graph.facebook.com/" + deep).read
puts JSON.parse(content)['shares']
end