mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 04:37:54 +00:00
fixed some small bugs
This commit is contained in:
parent
cebd64b610
commit
eda4d02626
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user