Last active
December 16, 2015 01:39
-
-
Save raghubetina/5356426 to your computer and use it in GitHub Desktop.
Example of reading from the Graph API
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
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