Spaces:
Configuration error
Configuration error
Set all chrome options from dedicated function.
Browse files
functions/context_acquisition.py
CHANGED
@@ -51,14 +51,7 @@ def get_linkedin_profile_html(profile_url: str, wait_time: int = 10) -> str:
|
|
51 |
raise ValueError("URL must be a valid LinkedIn profile URL (containing 'linkedin.com/in/')")
|
52 |
|
53 |
# Configure Chrome options for headless browsing
|
54 |
-
chrome_options =
|
55 |
-
chrome_options.add_argument("--headless") # Run in background
|
56 |
-
chrome_options.add_argument("--no-sandbox")
|
57 |
-
chrome_options.add_argument("--disable-dev-shm-usage")
|
58 |
-
chrome_options.add_argument("--disable-gpu")
|
59 |
-
chrome_options.add_argument("--window-size=1920,1080")
|
60 |
-
chrome_options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
61 |
-
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
62 |
|
63 |
driver = None
|
64 |
try:
|
@@ -205,11 +198,13 @@ def setup_chrome_driver_options() -> Options:
|
|
205 |
Options: Configured Chrome options object
|
206 |
"""
|
207 |
chrome_options = Options()
|
208 |
-
chrome_options.add_argument("--headless")
|
209 |
chrome_options.add_argument("--no-sandbox")
|
210 |
chrome_options.add_argument("--disable-dev-shm-usage")
|
211 |
chrome_options.add_argument("--disable-gpu")
|
212 |
chrome_options.add_argument("--window-size=1920,1080")
|
|
|
|
|
213 |
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
|
214 |
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
|
215 |
chrome_options.add_experimental_option('useAutomationExtension', False)
|
|
|
51 |
raise ValueError("URL must be a valid LinkedIn profile URL (containing 'linkedin.com/in/')")
|
52 |
|
53 |
# Configure Chrome options for headless browsing
|
54 |
+
chrome_options = setup_chrome_driver_options()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
driver = None
|
57 |
try:
|
|
|
198 |
Options: Configured Chrome options object
|
199 |
"""
|
200 |
chrome_options = Options()
|
201 |
+
chrome_options.add_argument("--headless") # Run in background
|
202 |
chrome_options.add_argument("--no-sandbox")
|
203 |
chrome_options.add_argument("--disable-dev-shm-usage")
|
204 |
chrome_options.add_argument("--disable-gpu")
|
205 |
chrome_options.add_argument("--window-size=1920,1080")
|
206 |
+
chrome_options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
207 |
+
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
|
208 |
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
|
209 |
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
|
210 |
chrome_options.add_experimental_option('useAutomationExtension', False)
|