facebook_page_scraper
facebook_page_scraper copied to clipboard
No posts were found - with newest version
Hey,
I get this error: 2022-11-07 20:10:22,447 - facebook_page_scraper.driver_utilities - CRITICAL - No posts were found!
running: python3 posts.py
posts.py file (unchanged from readme.md suggestion): **#import Facebook_scraper class from facebook_page_scraper from facebook_page_scraper import Facebook_scraper
#instantiate the Facebook_scraper class
page_name = "metaai" posts_count = 10 browser = "chrome" proxy = "IP:PORT" #if proxy requires authentication then user:password@IP:PORT timeout = 600 #600 seconds headless = True meta_ai = Facebook_scraper(page_name, posts_count, browser, proxy=proxy, timeout=timeout, headless=headless)
json_data = meta_ai.scrap_to_json() print(json_data) **
Tries master and 4.x branches with the same result. Checked the code - I can't find that css selector on the facebook by myself as well, so will this be working, or did facebook change everything ? Thanks
Hey, It works for me. I tried both UI, the new one as well as the old one.
- Are you using a proxy properly? I can see you're using a proxy in the example but it seems to be hardcoded instruction.
- What region are you using it? It might happen that you're from some strict European country.
I think I found the issue. A dialogue to accept cookies appears for the people who are running the crawler in the European region. It was mentioned in this issue I remember #36. You can set headless=False
and watch crawler running, can confirm if that's the case for you too
Hey thanks for the answer. Removed proxy from arguments and used headless = False
Weird, that https shows insecure, and it seems that it gets stuck on cookies ppopup
![image](https://user-images.githubusercontent.com/10352466/200497591-bb5838d9-e138-4aa4-8feb-6b1e4457a769.png)
Is it the popup, or in my country (Lithuania) it is having different layout?
I've pushed the changes. to close that popup #38. Seems like there's another popup that shows up to alert for login, I was using the German location for scraping.
That popup is showing for European countries I think, it does appear for Asian countries.
In case if login popup shows up you can use the browser_profile
argument for bypassing that. You will need to have a Facebook account logged into the browser then copy the browser profile path for that browser session and pass it to the constructor. Something like this Facebook_scraper('mysql', headless=False, browser='firefox', browser_profile='YOUR PATH')
it will use that FB account for scraping but beware that it might get blocked as well.