brutalsavage / facebook-post-scraper

Facebook Post Scraper 🕵️🖱️
GNU General Public License v3.0
324 stars 116 forks source link

Problem on ec2 instance #43

Closed MatteoSerafino closed 3 years ago

MatteoSerafino commented 3 years ago

I'm trying to run this code on an ec2 instance.

However if I run: python scraper.py -page 'Crónica del Norte' -len 2

I get:

_Traceback (most recent call last): File "scraper.py", line 359, in postBigDict = extract(page=args.page, numOfPost=args.len, infinite_scroll=infinite, scrape_comment=scrape_comment) File "scraper.py", line 259, in extract browser = webdriver.Chrome(executable_path="./chromedriver", options=option) File "/home/ec2-user/anaconda3/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in init RemoteWebDriver.init( File "/home/ec2-user/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "/home/ec2-user/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/ec2-user/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/ec2-user/anaconda3/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exceptionclass(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

While if I run sudo python scraper.py -page 'Crónica del Norte' -len 2

_File "scraper.py", line 43 postid = f"https://www.facebook.com{postId.get('href')}" ^ SyntaxError: invalid syntax

What can it be?

fsyrhiz commented 3 years ago

try this : add: from webdriver_manager.chrome import ChromeDriverManager change: browser = webdriver.Chrome(ChromeDriverManager().install(),options=option) instead browser = webdriver.Chrome(executable_path="./chromedriver", options=option)

MatteoSerafino commented 3 years ago

thanks.

it works.

:-)