Scrapy, a fast high-level web crawling & scraping framework for Python.
fixed bug with html meta refresh in multiple lines (thanks Molvo for the patch)
Pablo Hoffmancf566d623868
diff --git a/scrapy/tests/test_utils_response.py b/scrapy/tests/test_utils_response.pyindex 62ca3be86..1f7c39773 100644--- a/scrapy/tests/test_utils_response.py+++ b/scrapy/tests/test_utils_response.py@@ -54,6 +54,14 @@ class ResponseUtilsTest(unittest.TestCase):response = Response(url='http://example.org', body=body)self.assertEqual(get_meta_refresh(response), ('5', 'http://example.org/newpage'))+ # meta refresh in multiple lines+ body = """<html><head>+ <META+ HTTP-EQUIV="Refresh"+ CONTENT="1; URL=http://example.org/newpage">"""+ response = Response(url='http://example.org', body=body)+ self.assertEqual(get_meta_refresh(response), ('1', 'http://example.org/newpage'))+def test_response_httprepr(self):r1 = Response("http://www.example.com")self.assertEqual(response_httprepr(r1), 'HTTP/1.1 200 OK\r\n\r\n')diff --git a/scrapy/utils/response.py b/scrapy/utils/response.pyindex 5169b990b..17d204377 100644--- a/scrapy/utils/response.py+++ b/scrapy/utils/response.py@@ -31,7 +31,7 @@ def get_base_url(response):response.cache['base_url'] = match.group(1) if match else response.urlreturn response.cache['base_url']-META_REFRESH_RE = re.compile(r'<meta[^>]*http-equiv[^>]*refresh[^>].*?(\d+);\s*url=([^"\']+)', re.IGNORECASE)+META_REFRESH_RE = re.compile(r'<meta[^>]*http-equiv[^>]*refresh[^>].*?(\d+);\s*url=([^"\']+)', re.DOTALL | re.IGNORECASE)def get_meta_refresh(response):""" Return a tuple of two strings containing the interval and url includedin the http-equiv parameter of the HTML meta element. If no url is included