Skip to content

Instantly share code, notes, and snippets.

@stephen-puiszis
Created April 11, 2013 02:22
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 stephen-puiszis/5360155 to your computer and use it in GitHub Desktop.
Save stephen-puiszis/5360155 to your computer and use it in GitHub Desktop.
Facebook API Demo
require 'open-uri'
require 'json'
your_access_token = "put your access token from the Graph API Explorer here"
url = "https://graph.facebook.com/me/home?fields=from,picture,link,source,name,description,type&access_token=#{your_access_token}"
result = JSON.parse(open(url).read)
posts = result["data"]
posts.each do |p|
if #something -- how will you test if the post is sharing a video?
puts "#{p["from"]["name"]} said, '#{p["message"]}'"
# print the link to video, for good measure
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment