Storing comments from a Facebook post for analysis

I’ve had a lot of feedback from my post detailing how to use Facepager to explore comments on facebook pages. While Facepager is a neat little tool I get a lot of feedback saying that users have difficulty setting it up. Since the Github repository of the tool itself doesn’t seem to have been updated in a while, I’m not sure how much time is worth investing in getting it to work for the long term usage. Many of the requests I get are simply asking for advice on how to download comments from one post. It is actually very simple to do using the Facebook Graph API explorer and there isn’t much need for Facepager to do it.

Here is my recipe:

Facebook Graph API Explorer

The first thing to do is head over to the Facebook API Graph explorer, you will need to sign in to Facebook so it can create an access token for you to make queries. One this page you will see a box where we will build our requests that looks something like this:


In this box we will construct out request, we are after comments on an object and the Facebook Graph documentation explains the request we need is:


so, to build the request we need the object id. Building this is a two part process, you need the id of the page, followed by an underscore and the id of actual post. The page id can be found by viewing the source, or even easier by copying the page URL and pasting it in to this id finding service. To find the post ID you need to navigate to the post and click the date. The id will then be displayed in the URL. I am using a post by XFM’s facebook page, the page ID is 208559300603and my post id is: 10156099354675604, so my object-id is : 208559300603_10156099354675604,  on the Graph page I replace the me?fields=id,name with /208559300603_10156099354675604/comments and press submit. You’ll see the comments appear in JSON in the box on the right like so.


Turn Facebook Explorer API output to CSV

JSON is no good for most the people who message me, however there is an easy way to manipulate the data and I use open-refine to do so.  Copy the JSON in to a text file, save it somewhere on your desktop and download the latest version of open refine.

Once you’ve started Open Refine you will be asked to open a file to start a project and you will want to navigate to your saved JSON file, once it has imported you will be asked to pick a node, just pick the first entry like so:


In the resulting project you will want to click export->comma separated file in the menu.

Still stuck? How-to video: