Scrapy, a fast high-level web crawling & scraping framework for Python.
Fixed typo and code indentation in the doc. Closes #307 and #308
Pablo Hoffman181d1c09aeba
diff --git a/docs/intro/tutorial.rst b/docs/intro/tutorial.rstindex 8a69d27f2..e29ac2e7b 100644--- a/docs/intro/tutorial.rst+++ b/docs/intro/tutorial.rst@@ -156,15 +156,15 @@ will get an output similar to this::2008-08-20 03:51:13-0300 [dmoz] INFO: Enabled spider middlewares: ...2008-08-20 03:51:13-0300 [dmoz] INFO: Enabled item pipelines: ...2008-08-20 03:51:14-0300 [dmoz.org] INFO: Spider opened- 2008-08-20 03:51:14-0300 [dmoz.org] DEBUG: Crawled <http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/> from <None>- 2008-08-20 03:51:14-0300 [dmoz.org] DEBUG: Crawled <http://www.dmoz.org/Computers/Programming/Languages/Python/Books/> from <None>+ 2008-08-20 03:51:14-0300 [dmoz.org] DEBUG: Crawled <http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/> (referer: <None>)+ 2008-08-20 03:51:14-0300 [dmoz.org] DEBUG: Crawled <http://www.dmoz.org/Computers/Programming/Languages/Python/Books/> (referer: <None>)2008-08-20 03:51:14-0300 [dmoz.org] INFO: Spider closed (finished)Pay attention to the lines containing ``[dmoz.org]``, which corresponds toour spider (identified by the domain ``"dmoz.org"``). You can see a log linefor each URL defined in ``start_urls``. Because these URLs are the startingones, they have no referrers, which is shown at the end of the log line,-where it says ``from <None>``.+where it says ``(referer: <None>)``.But more interesting, as our ``parse`` method instructs, two files have beencreated: *Books* and *Resources*, with the content of both URLs.@@ -342,21 +342,21 @@ Let's add this code to our spider::from scrapy.selector import HtmlXPathSelectorclass DmozSpider(BaseSpider):- name = "dmoz.org"- allowed_domains = ["dmoz.org"]- start_urls = [- "http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",- "http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"- ]+ name = "dmoz.org"+ allowed_domains = ["dmoz.org"]+ start_urls = [+ "http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",+ "http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"+ ]- def parse(self, response):- hxs = HtmlXPathSelector(response)- sites = hxs.select('//ul/li')- for site in sites:- title = site.select('a/text()').extract()- link = site.select('a/@href').extract()- desc = site.select('text()').extract()- print title, link, desc+ def parse(self, response):+ hxs = HtmlXPathSelector(response)+ sites = hxs.select('//ul/li')+ for site in sites:+ title = site.select('a/text()').extract()+ link = site.select('a/@href').extract()+ desc = site.select('text()').extract()+ print title, link, descNow try crawling the dmoz.org domain again and you'll see sites being printedin your output, run::