I am trying to access Facebook from Python 😀
I want to fetch some data which requires I be logged in in order to view. I know I will require cookies and such to view said data with Python, but I am entirely clueless when it comes to cookies.
How can I use Python to login to Facebook, navigate to multiple pages and retrieve some data?
Okay. Potentially this is a very large question. Instead of using the standard API to retrieve information, you wish to screen scrap?
It’s possible – although not recommended as screen scraping is reliant upon the HTML format not changing. However it’s not an impossible task.
To get started, you want to look at opening a url:
http://docs.python.org/library/urllib2.html
It’s super easy – The example on the page will show you something like this:
And you see you have HTML.
Now facebook will be smarter than your average site to circumvent this type of login ed: I hope
So you may wan to look at handling the session manually:
All snipped from the python docs.