Crawling facebook with R

January 15, 2012
By

[This article was first published on Romain Francois, Professional R Enthusiast - Tag - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


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

graph_api_explorer.png

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 ...

Blogroll:

To leave a comment for the author, please follow the link and comment on their blog: Romain Francois, Professional R Enthusiast - Tag - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)