Scrapy, a fast high-level web crawling & scraping framework for Python.
updated project templates to new item
Ismael Carnalese2b8817c33ba
diff --git a/scrapy/templates/project/module/items.py.tmpl b/scrapy/templates/project/module/items.py.tmplindex bf93a82e2..9bbe421a5 100644--- a/scrapy/templates/project/module/items.py.tmpl+++ b/scrapy/templates/project/module/items.py.tmpl@@ -1,6 +1,8 @@# Define here the models for your scraped items-from scrapy.item import ScrapedItem+from scrapy.item import Item, Field-class ${ProjectName}Item(ScrapedItem):+class ${ProjectName}Item(Item):+ # define the fields for your item here like:+ # name = Field()passdiff --git a/scrapy/templates/project/module/templates/spider_crawl.tmpl b/scrapy/templates/project/module/templates/spider_crawl.tmplindex 6186714bf..539003c1b 100644--- a/scrapy/templates/project/module/templates/spider_crawl.tmpl+++ b/scrapy/templates/project/module/templates/spider_crawl.tmpl@@ -15,11 +15,11 @@ class $classname(CrawlSpider):)def parse_item(self, response):+ xs = HtmlXPathSelector(response)i = ${ProjectName}Item()- #xs = HtmlXPathSelector(response)- #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'] = xs.select('//input[@id="sid"]/@value').extract()+ #i['name'] = xs.select('//div[@id="name"]').extract()+ #i['description'] = xs.select('//div[@id="description"]').extract()return [i]SPIDER = $classname()diff --git a/scrapy/templates/project/module/templates/spider_csvfeed.tmpl b/scrapy/templates/project/module/templates/spider_csvfeed.tmplindex 1b1e4f7f9..8d4b5dfc7 100644--- a/scrapy/templates/project/module/templates/spider_csvfeed.tmpl+++ b/scrapy/templates/project/module/templates/spider_csvfeed.tmpl@@ -14,9 +14,9 @@ class $classname(CSVFeedSpider):def parse_row(self, response, row):i = ${ProjectName}Item()- #i.url = row['url']- #i.name = row['name']- #i.description = row['description']+ #i['url'] = row['url']+ #i['name'] = row['name']+ #i['description'] = row['description']return iSPIDER = $classname()diff --git a/scrapy/templates/project/module/templates/spider_xmlfeed.tmpl b/scrapy/templates/project/module/templates/spider_xmlfeed.tmplindex e5c774d0b..22da2fec8 100644--- a/scrapy/templates/project/module/templates/spider_xmlfeed.tmpl+++ b/scrapy/templates/project/module/templates/spider_xmlfeed.tmpl@@ -8,9 +8,9 @@ class $classname(XMLFeedSpider):def parse_item(self, response, xSel):i = ${ProjectName}Item()- #i.url = xSel('url'.extract()- #i.name = xSel('name').extract()- #i.description = xSel('description').extract()+ #i['url'] = xSel('url'.extract()+ #i['name'] = xSel('name').extract()+ #i['description'] = xSel('description').extract()return iSPIDER = $classname()