标签:spider div 父类 yield tsp 方法 star com www.
1 import scrapy 2 3 4 class PostSpider(scrapy.Spider): 5 name = ‘post‘ 6 # allowed_domains = [‘www.xxx.com‘] 7 start_urls = [‘https://fanyi.baidu.com/sug‘] 8 9 def start_requests(self): 10 data = { 11 ‘kw‘:‘python‘ 12 } 13 for url in self.start_urls: 14 yield scrapy.FormRequest(url=url,formdata=data,callback=self.parse) 15 16 def parse(self, response): 17 print(response.text)
这里重写父类的start_requests方法
标签:spider div 父类 yield tsp 方法 star com www.
原文地址:https://www.cnblogs.com/liaopeng123/p/10472768.html