scottwernervt / favicon

Find a website's favicon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

advance512 opened this issue · 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'].

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 /.

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