oduwsdl/MementoEmbed

Exception while searching for favicon

Closed this issue · 0 comments

MementoEmbed throws an exception for the following URI-M:

Here is the log entry:

[2018-09-06 14:07:36,093 -0600 ] - ERROR - [ /services/product/socialcard/http://wayback.archive-it.org/4887/20141104211213/http://time.com/3502740/ebola-virus-1976/ ]: mementoembed.services.errors - An unforeseen error has occurred
Traceback (most recent call last):
  File "/Volumes/nerfherder External/Unsynced-Projects/MementoEmbed/mementoembed/services/errors.py", line 27, in handle_errors
    return function_name(urim, preferences)
  File "/Volumes/nerfherder External/Unsynced-Projects/MementoEmbed/mementoembed/services/product.py", line 77, in generate_socialcard_response
    original_favicon_uri = s.original_favicon
  File "/Volumes/nerfherder External/Unsynced-Projects/MementoEmbed/mementoembed/mementosurrogate.py", line 71, in original_favicon
    return self.originalresource.favicon
  File "/Volumes/nerfherder External/Unsynced-Projects/MementoEmbed/mementoembed/originalresource.py", line 49, in favicon
    candidate_favicon = get_favicon_from_html(self.content)
  File "/Volumes/nerfherder External/Unsynced-Projects/MementoEmbed/mementoembed/favicon.py", line 55, in get_favicon_from_html
    if 'icon' in link['rel']:
  File "/Users/smj/.virtualenvs/MementoEmbed-gkunwTeo/lib/python3.7/site-packages/bs4/element.py", line 1071, in __getitem__
    return self.attrs[key]
KeyError: 'rel'

The problem is that the code assumes that all link tags in html have a rel attribute.