From ff21281b957015f28018daead5347817738847c7 Mon Sep 17 00:00:00 2001 From: RasPat1 Date: Sun, 15 Dec 2013 13:46:42 -0500 Subject: [PATCH] Note about selector class import This is the salient point of this code compared to the last example. We have a selector now and this is how we use it. Especially since the user has just come from the shell where the pre-instantiated selector is taken for granted. --- docs/intro/tutorial.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/intro/tutorial.rst b/docs/intro/tutorial.rst index 2f3a997cb..290aa7e10 100644 --- a/docs/intro/tutorial.rst +++ b/docs/intro/tutorial.rst @@ -363,6 +363,8 @@ Let's add this code to our spider:: desc = site.xpath('text()').extract() print title, link, desc +Notice we import our Selector class from scrapy.selector and instantiate a +new Selector object. We can now specify our XPaths just as we did in the shell. Now try crawling the dmoz.org domain again and you'll see sites being printed in your output, run::