1 def parse(self,response): 2 l = ItemLoader(item = PropertiesItem(),response = response) 3 4 l.add_xpath('title','// * [@ itemprop =“name”] [1] / text()')l.add_xpath('price','.//*[@itemprop="price“] “'[1] / text()',re ='[,。0-9]+') 5 l.add_xpath('description','// * [@ itemprop =“description”]''[1] / text()') 6 l.add_xpath('address','// * [@ itemtype =''“ http://schema.org/Place”] [1] / text()') 7 l.add_xpath('image_urls','// * [@ itemprop =“image”] [1] / @ src') 8 9 return load_item()
转载于:https://www.cnblogs.com/realmonkeykingsun/p/8031214.html