facebook_page_scraper icon indicating copy to clipboard operation
facebook_page_scraper copied to clipboard

Error when scraping over 1000 posts

Open KBrianNgeno opened this issue 1 year ago • 5 comments

I'm trying to scrape a lot of data for a time series visualization. It crashes after some time and I get this error. Traceback (most recent call last): File "/home/brian/Attachment/KeNVIP Facebook Scrapper/fbScrapper.py", line 27, in <module> json_data = meta_ai.scrap_to_json() File "/home/brian/Attachment/KeNVIP Facebook Scrapper/env/fb_scrapper/lib/python3.10/site-packages/facebook_page_scraper/scraper.py", line 101, in scrap_to_json self.__find_elements(name) File "/home/brian/Attachment/KeNVIP Facebook Scrapper/env/fb_scrapper/lib/python3.10/site-packages/facebook_page_scraper/scraper.py", line 185, in __find_elements all_posts = Finder._Finder__find_all_posts( File "/home/brian/Attachment/KeNVIP Facebook Scrapper/env/fb_scrapper/lib/python3.10/site-packages/facebook_page_scraper/element_finder.py", line 357, in __find_all_posts Utilities.__close_driver(driver) AttributeError: type object 'Utilities' has no attribute '_Finder__close_driver'. Did you mean: '_Utilities__close_driver'?

KBrianNgeno avatar Jun 04 '23 13:06 KBrianNgeno

Can you share which version you used, and what code?

shaikhsajid1111 avatar Jun 04 '23 16:06 shaikhsajid1111

I'm not sure about the version but I downloaded it this past Friday. Here's my code: `from facebook_page_scraper import Facebook_scraper

page_name = "MinstryofHealthKE" posts_count = 5_000 browser = "chrome" timeout = 6_000 #seconds headless = False scraped_data = Facebook_scraper(page_name, posts_count, browser, timeout=timeout, headless=headless)

#call the scrap_to_json() method #json_data = scraped_data.scrap_to_json()

filename = "data_file" directory = "./" scraped_data.scrap_to_csv(filename, directory)`

KBrianNgeno avatar Jun 04 '23 17:06 KBrianNgeno

I will look into this but if you want that amount of posts that's difficult to do it in unauthenticated way, crawler will get blocked very easily

shaikhsajid1111 avatar Jun 04 '23 17:06 shaikhsajid1111

Okay. Thank you.

KBrianNgeno avatar Jun 04 '23 17:06 KBrianNgeno