Mining your posts
After introducing the Python facebook-sdk with a simple example, we will start digging into the data mining opportunities. The first exercise is to download our own posts (that is, the posts published by the authenticated user).
The facebook_get_my_posts.py
script connects to the Graph API and gets a list of posts published by the authenticated user me
. The posts are saved in the my_posts.jsonl
file using the JSON Lines format that we have already adopted in Chapter 2, #MiningTwitter - Hashtags, Topics, and Time Series, and Chapter 3, Users, Followers, and Communities on Twitter, (each line of the file is a JSON document):
# Chap04/facebook_get_my_posts.py import os import json import facebook import requests if __name__ == '__main__': ...
Get Mastering Social Media Mining with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.