Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,9 +38,6 @@ import zipfile
|
|
38 |
import os
|
39 |
import subprocess
|
40 |
|
41 |
-
import os
|
42 |
-
import subprocess
|
43 |
-
|
44 |
import streamlit as st
|
45 |
import numpy as np
|
46 |
import pandas as pd
|
@@ -77,23 +74,23 @@ job = st.sidebar.selectbox("Select one job", jobs)
|
|
77 |
num_jobs = st.sidebar.selectbox("Select number of jobs you want to scrap", nums)
|
78 |
|
79 |
# Function to get Selenium driver
|
80 |
-
|
|
|
|
|
|
|
81 |
@st.cache_resource
|
82 |
def get_driver():
|
83 |
-
options =
|
84 |
options.add_argument("--headless") # Run in headless mode
|
85 |
-
options.add_argument("--no-sandbox")
|
86 |
-
options.add_argument("--disable-dev-shm-usage")
|
87 |
-
|
88 |
-
options.add_argument("--window-size=1920x1080") # Set window size for headless mode
|
89 |
-
options.add_argument("--remote-debugging-port=9222") # Enable remote debugging
|
90 |
-
|
91 |
try:
|
92 |
-
driver = webdriver.
|
93 |
return driver
|
94 |
except Exception as e:
|
95 |
st.error(f"Error initializing WebDriver: {e}")
|
96 |
-
return None
|
97 |
|
98 |
import streamlit as st
|
99 |
from streamlit_option_menu import option_menu
|
|
|
38 |
import os
|
39 |
import subprocess
|
40 |
|
|
|
|
|
|
|
41 |
import streamlit as st
|
42 |
import numpy as np
|
43 |
import pandas as pd
|
|
|
74 |
num_jobs = st.sidebar.selectbox("Select number of jobs you want to scrap", nums)
|
75 |
|
76 |
# Function to get Selenium driver
|
77 |
+
from selenium import webdriver
|
78 |
+
from selenium.webdriver.firefox.service import Service as FirefoxService
|
79 |
+
from webdriver_manager.firefox import GeckoDriverManager
|
80 |
+
|
81 |
@st.cache_resource
|
82 |
def get_driver():
|
83 |
+
options = webdriver.FirefoxOptions()
|
84 |
options.add_argument("--headless") # Run in headless mode
|
85 |
+
options.add_argument("--no-sandbox")
|
86 |
+
options.add_argument("--disable-dev-shm-usage")
|
87 |
+
|
|
|
|
|
|
|
88 |
try:
|
89 |
+
driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()), options=options)
|
90 |
return driver
|
91 |
except Exception as e:
|
92 |
st.error(f"Error initializing WebDriver: {e}")
|
93 |
+
return None
|
94 |
|
95 |
import streamlit as st
|
96 |
from streamlit_option_menu import option_menu
|