Skip to content

Commit

Permalink
removed fields and include description
Browse files Browse the repository at this point in the history
  • Loading branch information
stummjr committed Jul 19, 2016
1 parent b74e26b commit caa80bc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions books/spiders/toscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ def parse_book_page(self, response):
item = {}
product = response.css("div.product_main")
item["title"] = product.css("h1 ::text").extract_first()
item["price"] = product.css("p.price_color ::text").re_first("(\d+.\d+)")
item["stock"] = product.xpath(
"normalize-space(./p[contains(@class, 'availability')])"
).re_first("(\d+) available")
item['category'] = response.xpath(
"//ul[@class='breadcrumb']/li[@class='active']/preceding-sibling::li[1]/a/text()"
).extract_first()
item['description'] = response.xpath(
"//div[@id='product_description']/following-sibling::p/text()"
).extract_first()
yield item

0 comments on commit caa80bc

Please sign in to comment.