2

I am scraping the facebook pages data, but to access all the data I need to log in to my account I am using.

import wget
from bs4 import BeautifulSoup
url = "https://www.facebook.com/hellomeets/events"

down = wget.download(url)

f = open(down, 'r')
htmlText = "\n".join(f.readlines())
f.close()
print htmlText

How do I log in to my account and scrape all the data of pages?

nymk
  • 3,323
  • 3
  • 34
  • 36
Harish
  • 425
  • 7
  • 22

2 Answers2

1

After some investigation, I found that Facebook implements some kind of CRSF protection, thus simple urllib3 or requests wouldn't work.

Try something like this : Login to Facebook using python requests which still uses requests, but with session

Community
  • 1
  • 1
taesu
  • 4,482
  • 4
  • 23
  • 41
0

For python3, you could use the urllib library.

Here's an example of someone using it to log in to a site.

How to use urllib in python 3?

Community
  • 1
  • 1
cameron-f
  • 431
  • 1
  • 3
  • 15