kevinzg / facebook-scraper

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

Profile information only sometime s working? #900

Open Rapid1898-code opened 2 years ago

Rapid1898-code commented 2 years ago

Hello - i try to get some informations from facebook-profiles with the following code: (the cookies i generated using the chrome Get cookies.txt extension)

from facebook_scraper import get_profile
erg = get_profile("zuck", cookies="cookie.txt")
for k,v in erg.items():
  print(f"\n{k}: {v}")  

This generally works fine for some facebook-sites like (besides some warnings that Facebook says "Unsupported Browser" whatever that means...) erg = get_profile("zuck", cookies="cookie.txt") or erg = get_profile("HotelDiplomatic", cookies="cookie.txt")

But with other facebook-sites like erg = get_profile("ParkHyattMendoza", cookies="cookie.txt") this is not working and i get the following error

$ python exmplFBScraper.py
G:\DEV\.venv\fb\lib\site-packages\facebook_scraper\facebook_scraper.py:912: UserWarning: Facebook says 'Unsupported Browser'
  warnings.warn(f"Facebook says 'Unsupported Browser'")
Traceback (most recent call last):
  File "G:\DEV\Python-Diverses\Facebookscraper\exmplFBScraper.py", line 38, in <module>
    erg = get_profile("ParkHyattMendoza", cookies="cookie.txt")
  File "G:\DEV\.venv\fb\lib\site-packages\facebook_scraper\__init__.py", line 85, in get_profile
    return _scraper.get_profile(account, **kwargs)
  File "G:\DEV\.venv\fb\lib\site-packages\facebook_scraper\facebook_scraper.py", line 403, in get_profile
    response = self.get(about_url)
  File "G:\DEV\.venv\fb\lib\site-packages\facebook_scraper\facebook_scraper.py", line 925, in get
    raise exceptions.NotFound(title.text)
facebook_scraper.exceptions.NotFound: Content Not Found
(fb)

Why is this? Is there something differnt with this site? Or do i have to use here other parameters / or cookie settings?

Ianneee commented 2 years ago

ParkHyattMendoza seems a page to me, not a profile. You can try with get_page_info.

Rapid1898-code commented 2 years ago

Hello - thanks for your response - I heard from "get_page_info" the first time - is there somewhere a documentation i am missing?

However i tried to run it with this code:

erg = get_page_info("ParkHyattMendoza", cookies="cookie.txt")
print(erg)
for k,v in erg.items():
  print(f"\n{k}: {v}")  

No error - but it simply outputs a empty dict. Is there any way to the the profile / page information for this site?

igorkf commented 1 year ago

I'm also trying to get page info and for most of the pages, it returns an empty dictionary.
For other pages, it returns only a dict with the name.

estebanpdl commented 1 year ago

Same here. Is there an option to get page info (e.g., creation date, categories, description, etc)?