mirror of https://github.com/scrapy/scrapy.git
updated project templates to new item
This commit is contained in:
parent
c08d3aa9cc
commit
e2b8817c33
|
|
@ -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()
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 i
|
||||
|
||||
SPIDER = $classname()
|
||||
|
|
|
|||
|
|
@ -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 i
|
||||
|
||||
SPIDER = $classname()
|
||||
|
|
|
|||
Loading…
Reference in New Issue