From 71dd5d0bf9d0c41d70e72b0fd0a89528ef246065 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Tue, 7 Feb 2017 06:11:08 +0500 Subject: [PATCH] strip URL extracted from selectors (as per html5 standard) --- scrapy/http/response/text.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scrapy/http/response/text.py b/scrapy/http/response/text.py index 1718b1f3b..5bfd2debb 100644 --- a/scrapy/http/response/text.py +++ b/scrapy/http/response/text.py @@ -142,10 +142,9 @@ class TextResponse(Response): if isinstance(url, Link): url = url.url elif isinstance(url, parsel.Selector): - url = _url_from_selector(url) + url = _url_from_selector(url).strip() elif isinstance(url, parsel.SelectorList): - raise ValueError("Please pass either string") - + raise ValueError("SelectorList is not supported") encoding = self.encoding if encoding is None else encoding url = self.urljoin(url)