Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

update spider templates to use .get

Mikhail Korobov8c29be606c1b
diff --git a/scrapy/templates/spiders/crawl.tmpl b/scrapy/templates/spiders/crawl.tmpl
index 802cb88a1..878425125 100644
--- a/scrapy/templates/spiders/crawl.tmpl
+++ b/scrapy/templates/spiders/crawl.tmpl
@@ -14,8 +14,8 @@ class $classname(CrawlSpider):
)
def parse_item(self, response):
- i = {}
- #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
+ item = {}
+ #item['domain_id'] = response.xpath('//input[@id="sid"]/@value').get()
+ #item['name'] = response.xpath('//div[@id="name"]').get()
+ #item['description'] = response.xpath('//div[@id="description"]').get()
+ return item
diff --git a/scrapy/templates/spiders/xmlfeed.tmpl b/scrapy/templates/spiders/xmlfeed.tmpl
index 7c2ff8850..863c9772f 100644
--- a/scrapy/templates/spiders/xmlfeed.tmpl
+++ b/scrapy/templates/spiders/xmlfeed.tmpl
@@ -10,8 +10,8 @@ class $classname(XMLFeedSpider):
itertag = 'item' # change it accordingly
def parse_node(self, response, selector):
- i = {}
- #i['url'] = selector.select('url').extract()
- #i['name'] = selector.select('name').extract()
- #i['description'] = selector.select('description').extract()
- return i
+ item = {}
+ #item['url'] = selector.select('url').get()
+ #item['name'] = selector.select('name').get()
+ #item['description'] = selector.select('description').get()
+ return item