From ad36a4a6ae8376a779f9feb08adfb2ca4a59dbb4 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Wed, 8 Feb 2017 16:58:38 +0500 Subject: [PATCH] RegexLinkExtractor: add \x0c to whitespace characters, as per html5 standard --- scrapy/linkextractors/regex.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrapy/linkextractors/regex.py b/scrapy/linkextractors/regex.py index 0fc7b079f..e689b4727 100644 --- a/scrapy/linkextractors/regex.py +++ b/scrapy/linkextractors/regex.py @@ -10,9 +10,10 @@ linkre = re.compile( "|\s.*?>)(.*?)<[/ ]?a>", re.DOTALL | re.IGNORECASE) + def clean_link(link_text): """Remove leading and trailing whitespace and punctuation""" - return link_text.strip("\t\r\n '\"") + return link_text.strip("\t\r\n '\"\x0c") class RegexLinkExtractor(SgmlLinkExtractor):