mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Handling parser errors from lxml in icon fetching.
This commit is contained in:
parent
0175a8b26f
commit
7941e2f8b0
1 changed files with 7 additions and 3 deletions
|
@ -185,9 +185,13 @@ class IconImporter(object):
|
|||
def _url_from_html(self, content):
|
||||
url = None
|
||||
if not content: return url
|
||||
icon_path = lxml.html.fromstring(content).xpath(
|
||||
'//link[@rel="icon" or @rel="shortcut icon"]/@href'
|
||||
)
|
||||
try:
|
||||
icon_path = lxml.html.fromstring(content).xpath(
|
||||
'//link[@rel="icon" or @rel="shortcut icon"]/@href'
|
||||
)
|
||||
except lxml.etree.ParserError:
|
||||
return url
|
||||
|
||||
if icon_path:
|
||||
if str(icon_path[0]).startswith('http'):
|
||||
url = icon_path[0]
|
||||
|
|
Loading…
Add table
Reference in a new issue