Created
December 28, 2017 14:34
-
-
Save jsuchal/ec315367e831079241e41481271f4279 to your computer and use it in GitHub Desktop.
This file contains 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 'rubygems' | |
require 'bundler/setup' | |
require 'koala' | |
require 'date' | |
access_token = 'xxx' # fill in from https://developers.facebook.com/tools/explorer | |
Koala.configure do |config| | |
config.api_version = 'v2.11' | |
end | |
api = Koala::Facebook::API.new(access_token) | |
feed = api.get_object("me/feed", { limit: 500, fields: 'shares,reactions.summary(total_count).limit(0),message,link,type,created_time,permalink_url' }) | |
begin | |
feed.each do |item| | |
puts [DateTime.strptime(item['created_time']).to_date, item['type'], item['permalink_url'], item.dig('reactions', 'summary', 'total_count'), item.dig('shares', 'count')].join(';') | |
end | |
break unless feed.next_page_params | |
feed = feed.next_page | |
end while true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment