kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.38k stars 627 forks source link

couldn't get any posts #535

Open paulorgp opened 2 years ago

paulorgp commented 2 years ago

Hello. Suddenly the script stopped working. Returns only the message "couldn't get any posts". What happened?

xobius commented 2 years ago

Hello Paulo, I also have a same problem. Did you find any solution?

neon-ninja commented 2 years ago

Try latest master

paulorgp commented 2 years ago

It´s ok now!!! Thanks!!!

BennyWestsyde commented 2 years ago

Still not working here. It appears that the cli program is trying to build the url as "https://m.facebook.com/[username]/posts/" which returns a 404

neon-ninja commented 2 years ago

The scraper will try /posts/ first, and fallback to / if it fails

BennyWestsyde commented 2 years ago

I think that the issue for me might be that the username that I am trying to search has periods "." in it which may be messing up the search query. here is my output right here. p.s. I have changed the username so that I do not post anyones personal profile, but I have been using a real username and it returns a 404 every time

user@Users-MacBook-Pro % facebook-scraper --filename facebook.csv --pages 10 -v first.last.1
Exception while requesting URL: https://m.facebook.com/first.last.1/posts/
Exception: HTTPError('404 Client Error: Not Found for url: https://m.facebook.com/first.last.1/posts/?locale=en_US')
Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.10.0/lib/python3.10/site-packages/facebook_scraper/facebook_scraper.py", line 569, in get
    response.raise_for_status()
  File "/Users/user/.pyenv/versions/3.10.0/lib/python3.10/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://m.facebook.com/first.last.1/posts/?locale=en_US
404 Client Error: Not Found for url: https://m.facebook.com/first.last.1/posts/?locale=en_US
No raw posts (<article> elements) were found in this page.
Couldn't get any posts.
neon-ninja commented 2 years ago

You need to pass cookies to access posts by a Profile. See the README