From fcdbe563a5516d6bc15dfe0c3682ad27b36d6275 Mon Sep 17 00:00:00 2001 From: Yuri Baburov Date: Mon, 27 Jul 2015 10:06:28 +0600 Subject: [PATCH] Fixed #49. Bump to 0.6.0.4 --- readability/readability.py | 9 ++++++++- setup.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/readability/readability.py b/readability/readability.py index 5d7ac2c..9b3c9c9 100755 --- a/readability/readability.py +++ b/readability/readability.py @@ -110,7 +110,14 @@ class Document: doc = html_cleaner.clean_html(doc) base_href = self.url if base_href: - doc.make_links_absolute(base_href, resolve_base_href=True) + # trying to guard against bad links like + try: + # such support is added in lxml 3.3.0 + doc.make_links_absolute(base_href, resolve_base_href=True, handle_failures='discard') + except TypeError: #make_links_absolute() got an unexpected keyword argument 'handle_failures' + # then we have lxml < 3.3.0 + # please upgrade to lxml >= 3.3.0 if you're failing here! + doc.make_links_absolute(base_href, resolve_base_href=True) else: doc.resolve_base_href() return doc diff --git a/setup.py b/setup.py index b65bc39..e6a0904 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ if sys.platform == 'darwin': setup( name="readability-lxml", - version="0.6.0.3", + version="0.6.0.4", author="Yuri Baburov", author_email="burchik@gmail.com", description="fast python port of arc90's readability tool",