How to read Facebook information in MATLAB?

3 次查看(过去 30 天)
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 个评论
Sean de Wolski
Sean de Wolski 2011-8-18
Looks like you may be working toward the one useful use for Facebook.
Congrats +1

请先登录,再进行评论。

采纳的回答

Sreeram Mohan
Sreeram Mohan 2011-8-18
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 个)

Sreeram Mohan
Sreeram Mohan 2011-8-18
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 个评论
Cedric
Cedric 2015-9-23
编辑:Cedric 2015-9-23
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 2015-9-23
PS: if you open a new thread, please post a link here as a comment so I see it.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by