Technology

Steps to extract Facebook data of user using Python Script in SAP DI

Facebook data is all about information we share on this social media platform like status , photos , profile picture ,friends list etc.Facebook collects information about how you interact with its platform, things you share and like, things you click on and don’t, when you’re using it, what devices, where those devices are located, etc.

Lets check how you can extract some basic info from facebook.

Login into Facebook developer account with your facebook user id and create one new application.

Then Click on tools and go to Graph API Explorer

In Graph API explorer you need to generate access token . First add all the permission which you want to display while extracting facebook data and then click on Generate token.There are various permission like user_friends,user_photos,user_location etc. , select out of these and click on Add a permission.

Graph to extract Facebook Details

Need to create custom python operator to send request to Facebook Graph API

Python script to retrieve user data

Use syntax mentioned in Python script to retrieve the User profile information. In the script you have to mention the token which you generated in GRAPH API explorer. Also note: Token will get expired after every two hours , so you have regenerate it again. Howerver you can increase the validity of Token using some options which you can check online

If module request is not present in current Python library then you need to create new custom python operator using docker file .”Request” Function is used to send Https request to server.

Output

Output will come in JSON format

One thought on “Steps to extract Facebook data of user using Python Script in SAP DI

  • Great article! I’m using an easier way. I’ve installed a software called cucomm. It allows me to collect user fb data that I can transfer to Excel. Also, it can automatically send messages, which significantly saves time. I advise you to try it.

Comments are closed.