As of now, you must be familiar with the word API. Nowadays social APIs are playing an important role to gather information about an individual or an organisation or almost anything. So we will be looking at implementing Facebook Graph API using python to mine some data from Facebook.
If you go to https://developers.facebook.com/docs/, you will find the languages for which facebook provides API support. But, facebook doesn’t provide an official client for python. So, we will be using Facebook SDK instead for the purpose. Before we get started to mine(extract or data mining) some data let's first install the Facebook SDK for python. It's quiet simple:
sudo pip install facebook-sdk
Before jumping into data mining from Facebook, there are some requirements which we must fulfill beforehand. We need an
Access Token to access any data from the social networking site and gather information. So, what is an
To keep it simple, let's say it's a kind of access code or permission which Facebook(or any other website) provides, so that you can access the data as a legitimate user and they can keep track of it.
An access token is an object that describes the security context of a process or thread. The information in the token includes the identity and privileges of the user account associated with the process or thread.
You need to have a Facebook account to request an access token. Now follow the following steps:
App IDis generated visit https://developers.facebook.com/tools/explorer/
$ set FACEBOOK_TEMP_TOKEN = "YOUR_TOKEN".
But, since these token expire after some time you need to update it again and again.