facebook_page_scraper icon indicating copy to clipboard operation
facebook_page_scraper copied to clipboard

No posts were found - with newest version

Open pastebimas opened this issue 1 year ago • 4 comments

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

pastebimas avatar Nov 07 '22 18:11 pastebimas

Hey, It works for me. I tried both UI, the new one as well as the old one.

  1. Are you using a proxy properly? I can see you're using a proxy in the example but it seems to be hardcoded instruction.
  2. What region are you using it? It might happen that you're from some strict European country.

shaikhsajid1111 avatar Nov 08 '22 05:11 shaikhsajid1111

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

shaikhsajid1111 avatar Nov 08 '22 06:11 shaikhsajid1111

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

Is it the popup, or in my country (Lithuania) it is having different layout?

pastebimas avatar Nov 08 '22 07:11 pastebimas

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.

shaikhsajid1111 avatar Nov 08 '22 08:11 shaikhsajid1111