标签:框架 visit res log example 传递 return site callback
def parse_page1(self, response):
return scrapy.Request("http://www.example.com/some_page.html",
callback=self.parse_page2)
def parse_page2(self, response):
# this would log http://www.example.com/some_page.html
self.logger.info("Visited %s", response.url)
def parse_page1(self, response):
item = MyItem()
item['name'] = response.css('.name::text').extract_first()
request = scrapy.Request("http://www.example.com/some_page.html",
callback=self.parse_page2)
request.meta['item'] = item
yield request
def parse_page2(self, response):
item = response.meta['item']
item['age'] = response.css('.age::text').extract_first()
yield item
标签:框架 visit res log example 传递 return site callback
原文地址:https://www.cnblogs.com/hankleo/p/11909372.html