From c5d93d626ca5cb1e8a7feff55fe8a06a461d2bb3 Mon Sep 17 00:00:00 2001 From: askiiart Date: Sat, 4 Jan 2025 18:13:48 -0600 Subject: [PATCH] clean up code --- owug.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/owug.py b/owug.py index b783b8a..4fd6d4a 100644 --- a/owug.py +++ b/owug.py @@ -29,14 +29,13 @@ soup = BeautifulSoup(html, 'html5lib') # hardcode favicon favicons = soup.find_all('link', rel='icon') for favicon in favicons: - if 'icon' in favicon.attrs['rel']: - url = absolute_url(favicon.attrs['href'], domain_thing) + url = absolute_url(favicon.attrs['href'], domain_thing) - mime_type = requests.head(url).headers['Content-Type'] - as_base64 = b64encode_as_string(requests.get(url).content) - new_url = f'data:{mime_type};base64,{as_base64}' + mime_type = requests.head(url).headers['Content-Type'] + as_base64 = b64encode_as_string(requests.get(url).content) + new_url = f'data:{mime_type};base64,{as_base64}' - favicon.attrs['href'] = new_url + favicon.attrs['href'] = new_url # hardcode images imgs = soup.find_all('img')