title: Scrapy Python Craigslist Scraper
body: <p>I am trying to scrape Craigslist classifieds using <b>Scrapy</b> to extract items that are for sale. </p>
  
  <p>I am able to extract <b>date, post title, and post url</b> but am having trouble extracting <b>price</b>.</p>
  
  <p>For some reason the current code extracts <b>all</b> of the prices, but when I remove the <b>//</b> before the price span look up the price field returns as empty.</p>
  
  <p>Can someone please review the code below and help me out?</p>
  
  <pre><code>from scrapy.spider import BaseSpider
      from scrapy.selector import HtmlXPathSelector
      from craigslist_sample.items import CraigslistSampleItem
  
      class MySpider(BaseSpider):
          name = "craig"
          allowed_domains = ["craigslist.org"]
          start_urls = ["http://longisland.craigslist.org/search/sss?sort=date&amp;query=raptor%20660&amp;srchType=T"]
  
  def parse(self, response):
      hxs = HtmlXPathSelector(response)
      titles = hxs.select("//p")
      items = []
      for titles in titles:
          item = CraigslistSampleItem()
          item['date'] = titles.select('span[@class="itemdate"]/text()').extract()
          item ["title"] = titles.select("a/text()").extract()
          item ["link"] = titles.select("a/@href").extract()
          item ['price'] = titles.select('//span[@class="itempp"]/text()').extract()
          items.append(item)
      return items
  </code></pre>