Must log in when scraping facebook posts

Viewed 271

I am trying to extract comments from public facebook posts, so I've gathered a certain number of posts' URLs and then I started to scrape them one by one, but while I'm running my code several times I got this window below. Apparently, I have to log in, however I want to scrape them without logging in. I've tried to use proxies, but the problem still the same.

Could someone please provide me with an explanation!

https://drive.google.com/file/d/1brifbNqVvUE4JzlfJCDdvoM0Pw0LhVDR/view?usp=sharing

1 Answers

I think once you are login into facebook domain, then you can launch post URL one by one like this :

Ley's say you have a URL list like this :-

url = ['https://www.facebook.com/post1', 'https://www.facebook.com/post2', 'https://www.facebook.com/post3', ..]

you can iterate to all the post like :

url = ['https://www.facebook.com/post1', 'https://www.facebook.com/post2', 'https://www.facebook.com/post3']
s = len(url)
print(s)
for a in range(s):
    driver.get(url[a])
    time.sleep(2)
Related