Yassmen commited on
Commit
1e807fb
1 Parent(s): 409611d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -38,14 +38,27 @@ import zipfile
38
  import os
39
  import subprocess
40
 
41
- #Settings for using the driver without a UI
 
 
 
 
 
 
 
 
 
 
 
 
42
  # Set up Chrome options
43
  options = webdriver.ChromeOptions()
44
- options.add_argument('--headless') # Run in headless mode
45
  options.add_argument('--no-sandbox')
46
  options.add_argument('--disable-dev-shm-usage')
 
47
  # Initialize the ChromeDriver
48
- service = Service('drivers/chromedriver')
49
  driver = webdriver.Chrome(service=service, options=options)
50
 
51
  from wuzzuf_scraper import Wuzzuf_scrapping
 
38
  import os
39
  import subprocess
40
 
41
+ import os
42
+ import subprocess
43
+
44
+ # Download ChromeDriver
45
+ def download_chromedriver():
46
+ url = "https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip" # Update version as needed
47
+ subprocess.run(["wget", url, "-O", "chromedriver.zip"])
48
+ subprocess.run(["unzip", "chromedriver.zip"])
49
+ subprocess.run(["chmod", "+x", "chromedriver"])
50
+
51
+ if not os.path.exists("chromedriver"):
52
+ download_chromedriver()
53
+
54
  # Set up Chrome options
55
  options = webdriver.ChromeOptions()
56
+ options.add_argument('--headless')
57
  options.add_argument('--no-sandbox')
58
  options.add_argument('--disable-dev-shm-usage')
59
+
60
  # Initialize the ChromeDriver
61
+ service = Service('./chromedriver')
62
  driver = webdriver.Chrome(service=service, options=options)
63
 
64
  from wuzzuf_scraper import Wuzzuf_scrapping