mirror of https://github.com/scrapy/scrapy.git
Merge pull request #524 from hobsonlane/master
documentation code example corrections per pablohoffman
This commit is contained in:
commit
ed6fd4933f
|
|
@ -129,6 +129,10 @@ For more information about XPath see the `XPath reference`_.
|
||||||
|
|
||||||
Finally, here's the spider code::
|
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):
|
class MininovaSpider(CrawlSpider):
|
||||||
|
|
||||||
name = 'mininova'
|
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()
|
torrent['size'] = sel.xpath("//div[@id='info-left']/p[2]/text()[2]").extract()
|
||||||
return torrent
|
return torrent
|
||||||
|
|
||||||
For brevity's sake, we intentionally left out the import statements. The
|
The ``TorrentItem`` class is :ref:`defined above <intro-overview-item>`.
|
||||||
Torrent item is :ref:`defined above <intro-overview-item>`.
|
|
||||||
|
|
||||||
Run the spider to extract the data
|
Run the spider to extract the data
|
||||||
==================================
|
==================================
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,8 @@ HttpAuthMiddleware
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
|
from scrapy.contrib.spiders import CrawlSpider
|
||||||
|
|
||||||
class SomeIntranetSiteSpider(CrawlSpider):
|
class SomeIntranetSiteSpider(CrawlSpider):
|
||||||
|
|
||||||
http_user = 'someuser'
|
http_user = 'someuser'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue