Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -73,10 +73,10 @@ def check_url():
|
|
73 |
return jsonify({'broken': True, 'favicon': None})
|
74 |
try:
|
75 |
# Follow redirects and check final status
|
76 |
-
response = requests.head(url, allow_redirects=True, timeout=
|
77 |
if response.status_code == 200:
|
78 |
# Fetch favicon for valid URLs
|
79 |
-
html_response = requests.get(url, timeout=
|
80 |
soup = BeautifulSoup(html_response.text, 'html.parser')
|
81 |
favicon_tag = soup.find("link", rel=["icon", "shortcut icon"])
|
82 |
favicon_url = favicon_tag['href'] if favicon_tag and 'href' in favicon_tag.attrs else None
|
|
|
73 |
return jsonify({'broken': True, 'favicon': None})
|
74 |
try:
|
75 |
# Follow redirects and check final status
|
76 |
+
response = requests.head(url, allow_redirects=True, timeout=10)
|
77 |
if response.status_code == 200:
|
78 |
# Fetch favicon for valid URLs
|
79 |
+
html_response = requests.get(url, timeout=10)
|
80 |
soup = BeautifulSoup(html_response.text, 'html.parser')
|
81 |
favicon_tag = soup.find("link", rel=["icon", "shortcut icon"])
|
82 |
favicon_url = favicon_tag['href'] if favicon_tag and 'href' in favicon_tag.attrs else None
|