scottwernervt / favicon

Find a website's favicon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError when making an int from empty width/height

philgyford opened this issue · comments

I don't know which site/favicon my code was trying to fetch when the final line in favicon.py generated:

File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 66, in get
link_icons = tags(response.url, response.text)
File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 142, in tags
width, height = dimensions(tag)
File "/webapps/oohdir/code/venv/lib/python3.10/site-packages/favicon/favicon.py", line 188, in dimensions
return int(width), int(height)
ValueError: invalid literal for int() with base 10: ''

But I've replicated the error for my tests with an HTML page that has an element like:

<link rel="icon" type="image/jpeg" sizes="x" href="/favicon.jpg" />

That sizes attribute results in the code trying to make a width/height from "" and generating the ValueError.