So, let’s crawl some data out of facebook using R. Don’t get too excited though, this is just a weekend whatif project. Anyway, so for example, I want to download some photos where I’m tagged.
First, we need an access token from facebook. I don’t know how to get this programmatically, so let’s get one manually, log on to facebook and then go to the Graph API Explorer
Grab the access token and save it into a variable in R
access_token <- "************..."
Now we need to study the graph api to figure out the url we need to build to do what we want to do, e.g. here we want "me/photos". I've wrapped this into an R function:
And then we can use it:
That's it, I told you it was not that exciting, but it was still worth playing with ...
Mining Facebook Data: Most "Liked" Status and Friendship Network.
- Download your Facebook photos using R