PyQuarX commited on
Commit
636189b
·
verified ·
1 Parent(s): dd37df9

Update scraper.py

Browse files
Files changed (1) hide show
  1. scraper.py +7 -12
scraper.py CHANGED
@@ -8,20 +8,15 @@ from shutil import which
8
  def scrape_website(website):
9
  print("Launching chrome browser...")
10
 
11
- chrome_driver_path = which("chromedriver")
12
- chrome_binary_path = which("chromium-browser") or which("chromium")
13
-
14
- if not chrome_driver_path or not chrome_binary_path:
15
- raise EnvironmentError("chromedriver or chromium-browser not found in PATH")
16
-
17
  options = webdriver.ChromeOptions()
18
- options.binary_location = chrome_binary_path
19
- options.add_argument("--headless")
20
- options.add_argument("--no-sandbox")
21
- options.add_argument("--disable-dev-shm-usage")
 
 
22
 
23
- service = Service(executable_path=chrome_driver_path)
24
- driver = webdriver.Chrome(service=service, options=options)
25
 
26
  try:
27
  driver.get(website)
 
8
  def scrape_website(website):
9
  print("Launching chrome browser...")
10
 
11
+ chrome_driver_path = "/usr/lib/chromium/chromedriver"
 
 
 
 
 
12
  options = webdriver.ChromeOptions()
13
+ options.binary_location = "/usr/bin/chromium"
14
+ options.add_argument('--no-sandbox')
15
+ options.add_argument('--headless')
16
+ options.add_argument('--disable-dev-shm-usage')
17
+
18
+ driver = webdriver.Chrome(service=Service(chrome_driver_path), options=options)
19
 
 
 
20
 
21
  try:
22
  driver.get(website)