favicon icon indicating copy to clipboard operation
favicon copied to clipboard

Error with URL https://www.commercecentric.com causes no valid icons to be returned

Open advance512 opened this issue 5 years ago • 2 comments

Though there are some valid icons, none are returned. Instead, this error is thrown:

Traceback (most recent call last):
  File "/src/logic/website_scraping.py", line 312, in getWebsiteScrapedDataForURL
    potentialIcons = favicon.get(
  File "/.venv/lib/python3.8/site-packages/favicon/favicon.py", line 66, in get
    link_icons = tags(response.url, response.text)
  File "/.venv/lib/python3.8/site-packages/favicon/favicon.py", line 142, in tags
    width, height = dimensions(tag)
  File "/.venv/lib/python3.8/site-packages/favicon/favicon.py", line 176, in dimensions
    width, height = re.split(r'[x\xd7]', size[0])
ValueError: not enough values to unpack (expected 2, got 1)

size is an array with contents: ['32/32'].

advance512 avatar Jun 17 '20 09:06 advance512

The code is looking for <width>x<height>, e.g. 32x32, so we just need to update width, height = re.split(r'[x\xd7]', size[0]) to support /.

scottwernervt avatar Jun 17 '20 14:06 scottwernervt

Pull request #32 should fix this, and add support for passing in HTML input.

advance512 avatar Jun 17 '20 20:06 advance512