Member-only story

Python HOW: Getting Facebook Data and Insights Using facebook-sdk

Gabriel Harris Ph.D.
4 min readFeb 19, 2019

--

Photo by Pixabay from Pexels

At the end of this article you will learn how to get valuable data and insights of a page you’re an admin. It assumes you’ve already obtained a permanent page token. If you’ve not, check my 👉 article first

TL;DR: full code

The Graph API 🍇

Data in FB is represented using the idea of a “social graph”. To interact with a graph we use an HTTPS-based API called the Graph API. To return a graph object using the obtained page token:

A graph is made up of 3 hierarchical components:

  1. A node which is an individual object with a unique ID
  2. An edge which is a connection between one node and another
  3. Fields which are node properties

Example 1: a page object is a node, all its posts are edges, and the page’s about and category are some of its fields

--

--

Gabriel Harris Ph.D.
Gabriel Harris Ph.D.

Written by Gabriel Harris Ph.D.

I’m an End-to-End Lead Data Scientist and Data Science Manager. My articles are love letters to my future self

Responses (6)

Write a response