def test_get_price(self): string = '<font color="#CC0000">$399.98</font></b> if you buy today!</font>' self.assertTrue(399.98 == StringOp.get_price(string)) string = '>$359.99</span></b></font>\xa0' price = StringOp.get_price(string) print price self.assertTrue(359.99 == price)
def parse_item(self, response): regular_price = StringOp.get_price(response.xpath('//*[@id="div_price"]').re(r'regular price of(.*)')) price = StringOp.get_price(response.xpath('//*[@id="div_price"]').re(r'itemprop="price">\s*(.*)')) url = response.url if 'intel' in url: specifications = response.xpath('//div [@class="productdetaildiv"]/table').extract() item = StackItem() item['url'] = url yield item