From eacc5937e41e57ccabee7549b06c774cebfc7dea Mon Sep 17 00:00:00 2001 From: Randy Pen Date: Fri, 7 Oct 2016 16:48:57 +0800 Subject: [PATCH 1/2] fix example code In the AuthorSpider, original css selector failed to get links of author pages --- docs/intro/tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/intro/tutorial.rst b/docs/intro/tutorial.rst index 4f2736709..89671910a 100644 --- a/docs/intro/tutorial.rst +++ b/docs/intro/tutorial.rst @@ -564,7 +564,7 @@ this time for scraping author information:: def parse(self, response): # follow links to author pages - for href in response.css('.author a::attr(href)').extract(): + for href in response.css('span a::attr(href)').extract(): yield scrapy.Request(response.urljoin(href), callback=self.parse_author) From c7d245b90b4ee9c6a006965dd91fca14f2efeef7 Mon Sep 17 00:00:00 2001 From: Randy Pen Date: Fri, 7 Oct 2016 22:52:58 +0800 Subject: [PATCH 2/2] update Thx for your advice. --- docs/intro/tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/intro/tutorial.rst b/docs/intro/tutorial.rst index 89671910a..0fb2c0b86 100644 --- a/docs/intro/tutorial.rst +++ b/docs/intro/tutorial.rst @@ -564,7 +564,7 @@ this time for scraping author information:: def parse(self, response): # follow links to author pages - for href in response.css('span a::attr(href)').extract(): + for href in response.css('.author+a::attr(href)').extract(): yield scrapy.Request(response.urljoin(href), callback=self.parse_author)