parameters: (self, response)
docstring: 获取商品信息
docstring_summary: 获取商品信息
docstring_tokens: 获取商品信息
function: def parse_goods_info(self, response):
          """
          获取商品信息
          """
          if response:
              self.crawler.stats.inc_value("Success_Reqeust")
              items = json.loads(response.text)['items']
              for item in items:
                  data = PinduoduoGoodsItem()
                  data['goods_id'] = str(item['goods_id'])
                  data['goods_name'] = item['goods_name']
                  data['hd_url'] = item['hd_url']
                  data['detail_url'] = 'http://yangkeduo.com/{}'.format(item['link_url'])
                  data['price'] = int(item['price'] / (self.settings.get('STATIC_NUM')))
                  data['sales'] = item['sales']
                  data['tags'] = ' '.join([tag['text'] for tag in item['tag_list']])
                  try:
                      data['mall_name'] = item['mall_name']
                  except:
                      data['mall_name'] = ''
                  self.logger.debug(data)
                  yield data
          else:
              self.logger.debug("No data obtained!")
function_tokens: def parse_goods_info ( self , response ) : if response : self . crawler . stats . inc_value ( "Success_Reqeust" ) items = json . loads ( response . text ) [ 'items' ] for item in items : data = PinduoduoGoodsItem ( ) data [ 'goods_id' ] = str ( item [ 'goods_id' ] ) data [ 'goods_name' ] = item [ 'goods_name' ] data [ 'hd_url' ] = item [ 'hd_url' ] data [ 'detail_url' ] = 'http://yangkeduo.com/{}' . format ( item [ 'link_url' ] ) data [ 'price' ] = int ( item [ 'price' ] / ( self . settings . get ( 'STATIC_NUM' ) ) ) data [ 'sales' ] = item [ 'sales' ] data [ 'tags' ] = ' ' . join ( [ tag [ 'text' ] for tag in item [ 'tag_list' ] ] ) try : data [ 'mall_name' ] = item [ 'mall_name' ] except : data [ 'mall_name' ] = '' self . logger . debug ( data ) yield data else : self . logger . debug ( "No data obtained!" )