smurfit89
smurfit89

Reputation: 337

how to mine this facebook post in R?

I want to get my feet into facebook mining and I have seen an interesting post which I want to extract:

https://www.facebook.com/zuck/posts/10103253901916271

This post is from Mark Zuckerberg and it is about the election in the US in 2016.

I installed the Rfacebook and RCurl packages and I also read the documentations.

The statement of

page <- getPage(page="humansofnewyork", token=fb_oauth, feed=TRUE)

just works for pages. Is there something so I can scrape from Zuckerberg's post with the id 10103253901916271?

page <- getPost("10103253901916271", mytoken , n = 100)

gave me the error

Error in callAPI(url = url, token = token, api = api) : 
(#12) singular statuses API is deprecated for versions v2.4 and higher

changing to

page <- getPost("10103253901916271", mytoken , n = 100, api ="v2.3")

gave me same error as well:

Error in callAPI(url = url, token = token, api = api) : 
(#12) singular statuses API is deprecated for versions v2.4 and higher

Thanks for your help.

Upvotes: 0

Views: 68

Answers (2)

andyrandy
andyrandy

Reputation: 73994

Scraping is not allowed on Facebook, and API access to the posts of a user profile is only possible by authorizing that user with the user_posts permission. The only way to do this is to ask Mark Zuckerberg to authorize your App with the user_posts permission and use his User Access Token.

In other words: it is impossible.

Upvotes: 1

BigTimeStats
BigTimeStats

Reputation: 447

Expanding on my comment..

You'll need to put the id in the getPost as [pageid]_[postid].

Here is an example from your humansofnewyork page:

page <- getPage(page="humansofnewyork", token=fb_oauth, feed=TRUE)

page$id[8]
# [1] "102099916530784_2103238599750229"

post <- getPost(post = page$id[8], n = 100, token=fb_oauth, likes=FALSE)

Upvotes: 0

Related Questions