kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.43k stars 628 forks source link

Profile information / error? #826

Open Rapid1898-code opened 2 years ago

Rapid1898-code commented 2 years ago

Hello - i try to get the profile-information with the following code:

from facebook_scraper import get_profile
get_profile("zuck")

But i only get this error message:

$ python exmplFBScraper.py
Traceback (most recent call last):
  File "C:\DEV\Python-Diverses\FacebookScraper\exmplFBScraper.py", line 38, in <module>
    get_profile("zuck")
  File "C:\DEV\.venv\test\lib\site-packages\facebook_scraper\__init__.py", line 84, in get_profile
    return _scraper.get_profile(account, **kwargs)
  File "C:\DEV\.venv\test\lib\site-packages\facebook_scraper\facebook_scraper.py", line 323, in get_profile
    top_post = PostExtractor(top_post, kwargs, self.get).extract_post()
  File "C:\DEV\.venv\test\lib\site-packages\facebook_scraper\extractors.py", line 204, in extract_post
    has_more = self.more_url_regex.search(self.element.html)
AttributeError: 'NoneType' object has no attribute 'html'
(test) 

Why is this not working as decribed in the readme?

ppfreitas commented 2 years ago

same problem here

neon-ninja commented 2 years ago

Try pass cookies as per the readme

neon-ninja commented 2 years ago

https://github.com/kevinzg/facebook-scraper/commit/8fd973b40553e7cb23aef3a86f74f3d3ac973788 should fix this when not using cookies

Rapid1898-code commented 2 years ago

Thanks a lot - maybe a stupid question - How can i update not this change to my local venv-environment? Should i simply overwrite the this one file "facebook_scraper.py" you changed? (or is there another recommended way to do this?)

Rapid1898-code commented 2 years ago

Works great now for the profile "zuck". But when i try to load the information with eg. "NintendoDE" i get the same error as before

neon-ninja commented 2 years ago

pip install git+https://github.com/kevinzg/facebook-scraper.git should work to install the latest master branch into your venv

The scraper tries to access https://m.facebook.com/NintendoDE/about and this triggers a redirect to https://m.facebook.com/login.php. Try pass cookies as per the readme