Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,9 +119,22 @@ def install_chrome_and_driver():
|
|
| 119 |
os.system("sudo apt-get install -y -f")
|
| 120 |
os.system("google-chrome-stable --version")
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
# Install Chromedriver (if not already installed)
|
| 123 |
chromedriver_autoinstaller.install()
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
install_chrome_and_driver()
|
| 126 |
|
| 127 |
# Function to send a request to Google Places API and fetch places data
|
|
@@ -197,7 +210,7 @@ def scrape_website_for_contact_info(website):
|
|
| 197 |
if phone_match:
|
| 198 |
phone_number = phone_match.group()
|
| 199 |
|
| 200 |
-
|
| 201 |
if email_match:
|
| 202 |
email = email_match.group()
|
| 203 |
|
|
|
|
| 119 |
os.system("sudo apt-get install -y -f")
|
| 120 |
os.system("google-chrome-stable --version")
|
| 121 |
|
| 122 |
+
# Fix ownership of /etc/sudo.conf
|
| 123 |
+
os.system("chown root:root /etc/sudo.conf")
|
| 124 |
+
|
| 125 |
+
# Verify Chrome installation
|
| 126 |
+
os.system("which google-chrome-stable")
|
| 127 |
+
if not os.path.exists("/usr/bin/google-chrome-stable"):
|
| 128 |
+
raise RuntimeError("Google Chrome was not installed correctly")
|
| 129 |
+
|
| 130 |
# Install Chromedriver (if not already installed)
|
| 131 |
chromedriver_autoinstaller.install()
|
| 132 |
|
| 133 |
+
# Verify Chromedriver installation
|
| 134 |
+
os.system("which chromedriver")
|
| 135 |
+
if not os.path.exists("/usr/local/bin/chromedriver"):
|
| 136 |
+
raise RuntimeError("ChromeDriver was not installed correctly")
|
| 137 |
+
|
| 138 |
install_chrome_and_driver()
|
| 139 |
|
| 140 |
# Function to send a request to Google Places API and fetch places data
|
|
|
|
| 210 |
if phone_match:
|
| 211 |
phone_number = phone_match.group()
|
| 212 |
|
| 213 |
+
email_match = re.search(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', soup.get_text())
|
| 214 |
if email_match:
|
| 215 |
email = email_match.group()
|
| 216 |
|