3

Hi I am using this code to get the data from the timeanddate.com site. But I need to do the same for my facebook accout using my username and password & grab the comments on my wall and write it to text file. Can I do this with python? How to do that?

import urllib2
from BeautifulSoup import BeautifulSoup


soup = BeautifulSoup(urllib2.urlopen('http://www.timeanddate.com/worldclock/astronomy.html?n=78').read())

for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
tds = row('td')
print tds[0].string, tds[1].string

Thanks....

2
  • Yes, you can do it in Python. I generally use the requests module and BeautifulSoup for screen scraping. I've never used authentication so far, but if requests is not enough, you could always emulate a browser, e.g. with mechanize, or use the API as said. Commented Nov 2, 2012 at 12:34
  • with facebook and the likes, I wouldn't try to screenscrape anything zdnet.com/plaxo-screen-scraper-tool-offends-facebook-1339284842 Commented Nov 2, 2012 at 12:36

1 Answer 1

7

Use Requests API. It handles authentication as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.