Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,13 +42,15 @@ class URLProcessor:
|
|
42 |
})
|
43 |
|
44 |
def validate_url(self, url: str) -> bool:
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
52 |
|
53 |
def fetch_content(self, url: str) -> Optional[str]:
|
54 |
"""Fetch content from URL with retry mechanism"""
|
|
|
42 |
})
|
43 |
|
44 |
def validate_url(self, url: str) -> bool:
|
45 |
+
"""Validate URL format and accessibility"""
|
46 |
+
try:
|
47 |
+
result = urlparse(url)
|
48 |
+
is_valid = all([result.scheme, result.netloc]) and validators.url(url)
|
49 |
+
logger.info(f"Validating URL: {url} - Result: {is_valid}")
|
50 |
+
return is_valid
|
51 |
+
except Exception as e:
|
52 |
+
logger.warning(f"Invalid URL format: {url} - {str(e)}")
|
53 |
+
return False
|
54 |
|
55 |
def fetch_content(self, url: str) -> Optional[str]:
|
56 |
"""Fetch content from URL with retry mechanism"""
|