简体   繁体   English

如何使用 python 从 facebook 获取信息?

[英]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.

相关问题 如何通过 Python 从 Facebook 获取信息 - How to fetch information from Facebook by Python 如何使用python从netcdf文件的标题中获取特定信息? - How to get a specific information from the header of a netcdf file using python? 如何使用 python 从每个文件中获取正确信息 - How to get the correct information from every file using python 如何从Python中的xlsx文件获取信息? - How to get information from an xlsx file in Python? 如何在Python中从网页获取更改信息 - How to get changing information from a webpage in Python 如何使用python获取Facebook OAuth令牌? - How to get facebook oauth token using python? 如何在Python中使用Facebook图形API获得Facebook朋友的喜欢 - How to get likes of facebook friends using facebook graph api in python 如何在Python中使用facebook SDK获取facebook帖子的所有评论? - How to get all comments of a facebook post using facebook SDK in Python? 如何在 python 中使用 BeautifulSoup 从 web 站点获取信息? - How can I get information from a web site using BeautifulSoup in python? 如何使用 WMI -(Windows Management Instrumentation)从 python 脚本获取远程系统硬件信息 - How can I get remote system hardware information using WMI -( Windows Management Instrumentation) from python script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM