update spider templates

This commit is contained in:
Daniel Graña 2014-04-14 20:10:42 -04:00
parent 1117687c47
commit 72f68dcc8e
4 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import scrapy
class $classname(scrapy.Spider):
name = "$name"
allowed_domains = ["$domain"]

View File

@ -3,6 +3,7 @@ from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from $project_name.items import ${ProjectName}Item
class $classname(CrawlSpider):
name = '$name'
allowed_domains = ['$domain']
@ -13,9 +14,8 @@ class $classname(CrawlSpider):
)
def parse_item(self, response):
sel = scrapy.Selector(response)
i = ${ProjectName}Item()
#i['domain_id'] = sel.xpath('//input[@id="sid"]/@value').extract()
#i['name'] = sel.xpath('//div[@id="name"]').extract()
#i['description'] = sel.xpath('//div[@id="description"]').extract()
#i['domain_id'] = response.xpath('//input[@id="sid"]/@value').extract()
#i['name'] = response.xpath('//div[@id="name"]').extract()
#i['description'] = response.xpath('//div[@id="description"]').extract()
return i

View File

@ -1,6 +1,7 @@
from scrapy.contrib.spiders import CSVFeedSpider
from $project_name.items import ${ProjectName}Item
class $classname(CSVFeedSpider):
name = '$name'
allowed_domains = ['$domain']

View File

@ -1,6 +1,7 @@
from scrapy.contrib.spiders import XMLFeedSpider
from $project_name.items import ${ProjectName}Item
class $classname(XMLFeedSpider):
name = '$name'
allowed_domains = ['$domain']