fixed some small bugs

This commit is contained in:
Saifeddine ALOUI 2024-02-10 12:12:40 +01:00
parent cebd64b610
commit eda4d02626

View File

@ -1,7 +1,8 @@
from ascii_colors import ASCIIColors, trace_exception
def get_favicon_url(url):
import requests
from bs4 import BeautifulSoup
try:
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
favicon_link = soup.find('link', rel='icon') or soup.find('link', rel='shortcut icon')
@ -11,7 +12,8 @@ def get_favicon_url(url):
if not favicon_url.startswith('http'):
favicon_url = url + favicon_url
return favicon_url
except:
ASCIIColors.warning(f"Couldn't get fav icon from {url}")
return None