How to read Facebook information in MATLAB?

7 views (last 30 days)
I want to read data from a group in Facebook to make a statistical analysis (number of posts by each member, number of "likes", etc.).
How can I access Facebook to extract this information?
I would appreciate any information that could point me in the right direction.
  1 Comment
Sean de Wolski
Sean de Wolski on 18 Aug 2011
Looks like you may be working toward the one useful use for Facebook.
Congrats +1

Sign in to comment.

Accepted Answer

Sreeram Mohan
Sreeram Mohan on 18 Aug 2011
I just tried a thing quickly !
[Object Status] = urlread('https://graph.facebook.com/Mathworks')
The Object should contain the relevant data which could be parsed to get the required info and the status returns if the attempt succeded !
Getting a good JSON object parser would make extracting information more easier though !
I tried using one of the file exchange submission here and it works smoothly with no issues !
Hope this helps better !
--sreeram
  1 Comment
ali fadaie
ali fadaie on 3 Apr 2017
Edited: ali fadaie on 3 Apr 2017
hi teacher.u can help how fetch data in facebook matlab??

Sign in to comment.

More Answers (1)

Sreeram Mohan
Sreeram Mohan on 18 Aug 2011
Here is an API published by facebook http://developers.facebook.com/docs/reference/api/
You should combine the calls with the matlab functions like urllread ..etc to get the data that you require !
Let me know if you need help !
--sreeram
  5 Comments
Cedric
Cedric on 23 Sep 2015
Edited: Cedric on 23 Sep 2015
I never worked with FB, so you should open a new thread and see if someone did it. The API is not something that you write, but something that you interact with. It is a way for you to access data programmatically and not through the usual "user friendly web page interface". It is not always available and sometimes you have just the web pages to work with. When available, it is documented usually in a developer section and the documentation tells you how to send a query to the server, and how to read what is returned.
When not available, you are left to parsing web pages. This is not always possible, e.g. when there is Flash or some client-side code like JS. When the information lies in the HTML source of web pages though, you can generally extract it using an XML parser (for the simplest and best structured pages), or regular expressions if it is not XML compliant (most cases are not) and you need to extract data using pattern matching. Images can be saved as well in this case, because you can extract their URL and it is easy to download them.
I know that FB has a developer portal and APIs. Your next moves should be..
  • Look at the FEX if someone implemented something relevant to your work already, or anything related to FB.
  • If not, check if you get anything through google (e.g. "How to extract facebook information using MATLAB").
  • If nothing is already available, see if there is an API by FB which can provide the data that you need.
  • Then open a new thread here that explains what you are trying to achieve, reference what you found on the FEX or elsewhere already if there is anything (and explain in what it doesn't solve your problem). Also describe what you found in the dev. corner at FB, if there is an API that could be used, etc.
If you get no information, no answer, find no relevant API, but you are able to describe precisely what you need to extract from specific web pages (provide examples), we can talk about a solution that extracts data from the HTML code of these web pages (if available). This is in fact what I did in my small example.
Cedric
Cedric on 23 Sep 2015
PS: if you open a new thread, please post a link here as a comment so I see it.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!