def process_detailpage(self): prod_url = self.response.meta["prod_url"] prod_name = self.response.meta["prod_name"] cat = self.response.meta["cat"] uid = get_uid(self.response.url) image = Image.open(StringIO(self.response.body)) image_file = "%s/%s.%s" % (self.tmpfile_dir, uid, image.format.lower()) image.save(image_file) price = gocr(image_file) log.msg("save image:%s, url:%s, price:%s" % (image_file, self.response.url, price)) self.save(prod_url, prod_name, cat, price) return 0
def process_detailpage(self): sku = self.response.meta['sku'] gurl = self.response.meta['gurl'] name = self.response.meta['name'] cat = self.response.meta['cat'] image = Image.open(StringIO(self.response.body)) image_file = "%s/%s.%s" % (self.tmpfile_dir, sku, image.format.lower()) image.save(image_file) price = gocr(image_file) log.msg('save image:%s, url:%s, price:%s' \ %(image_file, self.response.url, price)) self.save(gurl, name, cat, price) return 0