(self, response)
获取参数：list_id, flip, anti_content
获取参数：list_id, flip, anti_content
获取参数：list_id flip anti_content
def get_parameters(self, response):
        """
        获取参数：list_id, flip, anti_content
        """
        self.crawler.stats.inc_value("Success_Reqeust")
        goods_name = response.meta['goods_name']
        list_id = re.findall('"listID":"(.*?)"', response.text, re.S)[0]
        flip = re.findall('"flip":"(.*?)"', response.text, re.S)[0]
        with open('./utils/anti_content.js', 'r', encoding='utf-8') as f:
            js = f.read()
        for page in range(1, self.settings.get('MAX_PAGES') + 1):
            anti_content = execjs.compile(js).call('get_anti', response.url)
            data = {
                'gid': '',
                'source': 'search',
                'search_met': 'manual',
                'requery': '0',
                'list_id': list_id,
                'sort': 'default',
                'filter': '',
                'q': goods_name,
                'page': page,
                'size': '50',
                'flip': flip,
                'anti_content': anti_content,
                'pdduid': '0'
            }
            yield Request(url=self.search_url + urlencode(data),
                          headers=self.headers,
                          callback=self.parse_goods_info,
                          errback=self.error_back,
                          dont_filter=True)
def get_parameters ( self , response ) : self . crawler . stats . inc_value ( "Success_Reqeust" ) goods_name = response . meta [ 'goods_name' ] list_id = re . findall ( '"listID":"(.*?)"' , response . text , re . S ) [ 0 ] flip = re . findall ( '"flip":"(.*?)"' , response . text , re . S ) [ 0 ] with open ( './utils/anti_content.js' , 'r' , encoding = 'utf-8' ) as f : js = f . read ( ) for page in range ( 1 , self . settings . get ( 'MAX_PAGES' ) + 1 ) : anti_content = execjs . compile ( js ) . call ( 'get_anti' , response . url ) data = { 'gid' : '' , 'source' : 'search' , 'search_met' : 'manual' , 'requery' : '0' , 'list_id' : list_id , 'sort' : 'default' , 'filter' : '' , 'q' : goods_name , 'page' : page , 'size' : '50' , 'flip' : flip , 'anti_content' : anti_content , 'pdduid' : '0' } yield Request ( url = self . search_url + urlencode ( data ) , headers = self . headers , callback = self . parse_goods_info , errback = self . error_back , dont_filter = True )