def on_result(self, result): print result if not result or not result[0]['spu']: return sql = SQL() for m in result: sql.replace('wishlist', **m)
def on_result(self, result): print result if not result or not result[0]['title']: return sql = SQL() for x in result: sql.replace('jobs', **x)
def json_parser(self, response): jsonp_content = response.content json_content = re.sub(r'([a-zA-Z_0-9\.]*\()|(\);?$)', '', jsonp_content) decoded = json.loads(json_content) keyword = response.save['keyword'] keyword = keyword.encode("utf-8") sql = SQL() for x in decoded['data']['list']: if not x or not x['goodsPicUrl']: return img_url = x['goodsPicUrl'] img_file = "/Users/Gavin/python/higo/{keyword}/{goodsId}.jpg" img_file = img_file.format(keyword=keyword, goodsId=x['goodsId']) if not os.path.isfile(img_file): r = requests.get(img_url) with open(img_file, "wb") as code: code.write(r.content) result = { "goodsId": x['goodsId'], "goodsName": x['goodsName'], "price": x['price'], "salePrice": x['salePrice'], "goodsPicUrl": x['goodsPicUrl'], "isWish": x['isWish'], "class": keyword } sql.replace('goods', **result) return keyword
def on_result(self, result): print result if not result or not result[0]['spu']: return sql = SQL() for values in result: sql.replace('wish',**values)
def json_parser_detail(self, response): code = response.save['code'] sql = SQL() desc = "" for x in response.json['propertyInfoList']: desc = desc + x['propertykey'] + ":" + x['propertyValue'] + ";" result = { "code": response.save['code'], "name": response.save['name'], "img": response.save['img'], "skuAdv": response.save['skuAdv'], "sellPrice": response.save['sellPrice'], "marketPrice": response.save['marketPrice'], "stockNum": response.save['stockNum'], "skuPropertyInfo": response.save['skuPropertyInfo'], "salesCount": response.save['salesCount'], "points": response.save['points'], "brandName": response.save['brandName'], "sysDateTime": response.save['sysDateTime'], "content": desc } sql.replace('jyhgoods', **result) return response.save['name']
def json_parser_detail(self, response): code = response.save['code'] sql = SQL() desc = "" for x in response.json['propertyInfoList']: desc = desc + x['propertykey'] + ":" + x['propertyValue'] + ";" result = { "code":response.save['code'], "name":response.save['name'], "img":response.save['img'], "skuAdv":response.save['skuAdv'], "sellPrice":response.save['sellPrice'], "marketPrice":response.save['marketPrice'], "stockNum":response.save['stockNum'], "skuPropertyInfo":response.save['skuPropertyInfo'], "salesCount":response.save['salesCount'], "points":response.save['points'], "brandName":response.save['brandName'], "sysDateTime":response.save['sysDateTime'], "content" : desc } sql.replace('jyhgoods',**result) return response.save['name']
def on_result(self, result): print result if not result or not result['title']: return sql = SQL() sql.replace('jobs', **result)
def on_result(self, result): print result if not result or not result['spu']: return sql = SQL() sql.replace('wish',**result)
def on_result(self, result): if not result or not result['booktitle']: return sql = SQL() sql.replace('novel', **result)
def on_result(self, result): print(result) if not result or not result['title']: return sql = SQL() sql.replace('info', **result)