New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while searching for favicon #129

Closed
shawnmjones opened this Issue Sep 6, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@shawnmjones
Collaborator

shawnmjones commented Sep 6, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment