Scrapy, a fast high-level web crawling & scraping framework for Python.
Extract links with safe_url_string
Adrián Chaves61e74bac765d
diff --git a/scrapy/linkextractors/lxmlhtml.py b/scrapy/linkextractors/lxmlhtml.pyindex da525d52e..f5ef56ea4 100644--- a/scrapy/linkextractors/lxmlhtml.py+++ b/scrapy/linkextractors/lxmlhtml.py@@ -5,7 +5,7 @@ from urllib.parse import urljoinimport lxml.etree as etreefrom w3lib.html import strip_html5_whitespace-from w3lib.url import canonicalize_url+from w3lib.url import canonicalize_url, safe_url_stringfrom scrapy.link import Linkfrom scrapy.utils.misc import arg_to_iter, rel_has_nofollow@@ -66,7 +66,7 @@ class LxmlParserLinkExtractor(object):url = self.process_attr(attr_val)if url is None:continue- url = canonicalize_url(url, encoding=response_encoding)+ url = safe_url_string(url, encoding=response_encoding)# to fix relative links after process_valueurl = urljoin(response_url, url)link = Link(url, _collect_string_content(el) or u'',