templates: updated code

This commit is contained in:
Rolando Espinoza La fuente 2010-01-11 12:26:43 -04:00
parent e7ef2eba1e
commit 7bbc14dd15
2 changed files with 6 additions and 6 deletions

View File

@ -4,5 +4,5 @@
# See: http://doc.scrapy.org/topics/item-pipeline.html
class ${ProjectName}Pipeline(object):
def process_item(self, domain, item):
def process_item(self, spider, item):
return item

View File

@ -10,15 +10,15 @@ class $classname(CrawlSpider):
start_urls = ['http://www.$site/']
rules = (
Rule(SgmlLinkExtractor(allow=(r'Items/', )), 'parse_item', follow=True),
Rule(SgmlLinkExtractor(allow=r'Items/'), callback='parse_item', follow=True),
)
def parse_item(self, response):
xs = HtmlXPathSelector(response)
hxs = HtmlXPathSelector(response)
i = ${ProjectName}Item()
#i['site_id'] = xs.select('//input[@id="sid"]/@value').extract()
#i['name'] = xs.select('//div[@id="name"]').extract()
#i['description'] = xs.select('//div[@id="description"]').extract()
#i['site_id'] = hxs.select('//input[@id="sid"]/@value').extract()
#i['name'] = hxs.select('//div[@id="name"]').extract()
#i['description'] = hxs.select('//div[@id="description"]').extract()
return i
SPIDER = $classname()