Hi !
I am trying to do a web scarper (extract data from a page). However, I've run into multiple problems with scripts that work locally, yet not on pythonanywhere.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
try:
browser.get("www.google.com")
browser.get("www.goldapi.io")
finally:
browser.quit()
Google works, wikipedia works, but some other websites give errors.
Traceback (most recent call last):
File "/home/Elanu/mysite/oua2.py", line 23, in <module>
browser.get("www.goldapi.io")
File "/home/Elanu/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 437, in get
self.execute(Command.GET, {'url': url})
File "/home/Elanu/.local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute
self.error_handler.check_response(response)
File "/home/Elanu/.local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
(Session info: headless chrome=90.0.4430.212)
Stacktrace:
#0 0x562d077b2e89 <unknown>
Would love some help ! Would getting the first tier (Hacker - i believe) help with this ?
Thanks !