diff --git a/docs/intro/overview.rst b/docs/intro/overview.rst index 876f5950d..b7d28a1e6 100644 --- a/docs/intro/overview.rst +++ b/docs/intro/overview.rst @@ -129,6 +129,10 @@ For more information about XPath see the `XPath reference`_. Finally, here's the spider code:: + from scrapy.contrib.spiders import CrawlSpider, Rule + from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor + from scrapy.selector import Selector + class MininovaSpider(CrawlSpider): name = 'mininova' @@ -145,8 +149,7 @@ Finally, here's the spider code:: torrent['size'] = sel.xpath("//div[@id='info-left']/p[2]/text()[2]").extract() return torrent -For brevity's sake, we intentionally left out the import statements. The -Torrent item is :ref:`defined above `. +The ``TorrentItem`` class is :ref:`defined above `. Run the spider to extract the data ================================== diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst index 679a53a2c..f763d5b73 100644 --- a/docs/topics/downloader-middleware.rst +++ b/docs/topics/downloader-middleware.rst @@ -281,6 +281,8 @@ HttpAuthMiddleware Example:: + from scrapy.contrib.spiders import CrawlSpider + class SomeIntranetSiteSpider(CrawlSpider): http_user = 'someuser'