Skip to content
Get and save Facebook comments to txt or csv file.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
fb_utils.gemspec

README.md

FbUtils

fb_utils is Ruby gem that lets you get and save facebook comments.
You can save comment in txt or csv file.

Installation

Type

gem install fb_utils

or

add this to your Gemfile and run the bundle command

gem 'fb_utils'

Usage

Get comments

If you need to just get comments, call get method with URL

# return Array of comments
comments = FbUtils::Comment.get('http://www.example.com')
comment = comments.first
puts comment.id             #=> "388101711259_17396935"
puts comment.message        #=> "Hello world"
puts comment.created_time   #=> "2011-07-26T01:23:34+0000"
puts comment.from_name      #=> "Lukasz Kr"
puts comment.from_id        #=> "123456789101112"

Save comments

In order to save comments in file system, call save method with URL and file name.
You can choose txt or csv file type (or write your own writer).
Default is txt.

# Save comments in example_com.txt file
FbUtils::Comment.save('http://www.example.com', 'example_com')

# Save comments in example_com.csv file
FbUtils::Comment.save('http://www.example.com', 'example_com', :format => :csv)

# For csv file you can pass additional parameters
FbUtils::Comment.save('http://www.example.com', 'example_com',
        :format => :csv,
        :fields_terminated_by => ";", 
        :fields_enclosed_by => "'", 
        :lines_terminated_by => "\n"
)

References

http://developers.facebook.com/docs/reference/plugins/comments/

Something went wrong with that request. Please try again.