Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Update CrawlSpider Template with Selector changes
- Loading branch information
Showing
with
5 additions
and
5 deletions.
-
+5
−5
scrapy/templates/spiders/crawl.tmpl
|
|
@@ -1,4 +1,4 @@ |
|
|
from scrapy.selector import HtmlXPathSelector |
|
|
from scrapy.selector import Selector |
|
|
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor |
|
|
from scrapy.contrib.spiders import CrawlSpider, Rule |
|
|
from $project_name.items import ${ProjectName}Item |
|
@@ -13,9 +13,9 @@ class $classname(CrawlSpider): |
|
|
) |
|
|
|
|
|
def parse_item(self, response): |
|
|
hxs = HtmlXPathSelector(response) |
|
|
sel = Selector(response) |
|
|
i = ${ProjectName}Item() |
|
|
#i['domain_id'] = hxs.select('//input[@id="sid"]/@value').extract() |
|
|
#i['name'] = hxs.select('//div[@id="name"]').extract() |
|
|
#i['description'] = hxs.select('//div[@id="description"]').extract() |
|
|
#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() |
|
|
return i |