# -*- coding: utf-8 -*-import scrapyclass PostReqSpider(scrapy.Spider): name = 'post_req' # allowed_domains = ['www.bb.com'] start_urls = ['https://fanyi.baidu.com/sug'] # 默认这样的get # def start_requests(self): # for url in self.start_urls: # yield scrapy.Request(url=url,callback=self.parse) def start_requests(self): for url in self.start_urls: data = { 'kw':'dog' } yield scrapy.FormRequest(url=url, callback=self.parse,formdata=data) def parse(self, response): print(response.text)