Press "Enter" to skip to content

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:

facebook_query

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:

/{object-id}/comments

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.

facebook_explorer_edge

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:

open_refine_nodes

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

Still stuck? How-to video:

 

4 Comments

  1. Juan Juan

    Is there a way of expanding the limit of comments without being a page admin?

  2. Diem-Tu Diem-Tu

    Hi David,

    I have been using your great method for my PhD research for over six months now and it has been very effective and a true lifesaver! Unfortunately, today I have received this message on the Facebook Graph API Explorer website:
    {
    “error”: {
    “message”: “(#10) To use ‘Page Public Content Access’, your use of this endpoint must be reviewed and approved by Facebook. To submit this ‘Page Public Content Access’ feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.”,
    “type”: “OAuthException”,
    “code”: 10,
    “fbtrace_id”: “H2dvYgThVW2”
    }
    }

    As I am neither a developer nor do I have any programming skills, I would like to ask you for advice on this matter since I have no idea what to do…
    Many thanks in advance!
    Best wishes,
    Diem-Tu

  3. Aldo Novendi Aldo Novendi

    I get this error “(#10) To use ‘Page Public Content Access’, your use of this endpoint must be reviewed and approved by Facebook. To submit this ‘Page Public Content Access’ feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.”

    Can you please help me find out the solution?

  4. Diem-Tu Diem-Tu

    Hi David,
    I have used your method to store comments for my PhD research. Since around two weeks Facebook API Graph Explorer requests a review for this method.
    Do you have any advice what to do about that?
    Cheers, Diem-Tu

    This is the exact request:
    {
    “error”: {
    “message”: “(#10) To use ‘Page Public Content Access’, your use of this endpoint must be reviewed and approved by Facebook. To submit this ‘Page Public Content Access’ feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.”,
    “type”: “OAuthException”,
    “code”: 10,
    “fbtrace_id”: “AnpPn4h03j1”
    }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

css.php