[英]How to get information from facebook using python?
I've looked at a lot of questions and libs and didn't found exactly what I wanted.我查看了很多问题和库,但没有找到我想要的。 Here's the thing, I'm developing an application in python for a user to get all sorts of things from social networks accounts.事情是这样的,我正在 python 中开发一个应用程序,供用户从社交网络帐户中获取各种东西。 I'm having trouble with facebook.我在使用 facebook 时遇到问题。 I would like, if possible, a step-by-step tutorial on the code and libs to use to get a user's information, from posts to photos information (with the user's login information, and how to do it, because I've had a lot of problem with authentication).如果可能的话,我想要一个关于用于获取用户信息的代码和库的分步教程,从帖子到照片信息(包括用户的登录信息,以及如何操作,因为我已经身份验证有很多问题)。
Thank you谢谢
I strongly encourage you to use Facebook's own APIs.我强烈建议您使用 Facebook 自己的 API。
First of all, check out documentation on Facebook's Graph API https://developers.facebook.com/docs/reference/api/ .首先,查看 Facebook Graph API https://developers.facebook.com/docs/reference/api/上的文档。 If you are not familiar with JSON, DO read a tutorial on it (for instance http://secretgeek.net/json_3mins.asp ).如果您不熟悉 JSON,请阅读有关它的教程(例如http://secretgeek.net/json_3mins.asp )。
Once you grasp the concepts, start using this API.一旦你掌握了这些概念,就开始使用这个 API。 For Python, there are at several alternatives:对于 Python,有几种选择:
I would suggest you to check out the Python libraries, try out the examples in their documentation and see if they are working and do the stuff you need.我建议您查看 Python 库,尝试他们文档中的示例,看看它们是否正常工作并完成您需要的工作。
Only as a last resort, would I write a scraper and try to extract data with screenscraping (it is much more painful and breaks more easily).只有在万不得已的情况下,我才会编写一个爬虫并尝试通过屏幕抓取来提取数据(这更痛苦,更容易中断)。
I have not used this with Facebook, but in the past when I had to scrape a site that required login I used Mechanize to handle the login and scraping and Beautiful Soup to parse the resulting HTML.我没有将它与 Facebook 一起使用,但过去当我不得不抓取需要登录的网站时,我使用Mechanize来处理登录和抓取,并使用Beautiful Soup来解析生成的 HTML。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.