DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Emad has posted 58 posts at DZone. View Full User Profile

Print all your facebok liked pages names, URLs and when did you like it

  • submit to reddit
#!/usr/bin/env ruby
require 'koala' # gem install koala --no-document

# create a facebook app and get access token from here
# select "user_likes" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxx'
graph =

# get all likes
likes = []
page = graph.get_connections('me','likes')
	likes += page
end while page = page.next_page

# print them all then print total likes
likes.each do |l|
	puts "#{l['name']} -{l['id']} - #{l['created_time']}"
puts "Total likes : #{likes.length}"