我想用ItemLoader将链接保存到item中
基本上,我需要转换此代码:
def parse(self, response):
for casa in response.css('div.posting-card'):
item = ZonapropItem()
item['link'] = response.urljoin(casa.css('a.go-to-posting::attr(href)').get())
yield item
进入:
def(parse, response):
for casa in response.css('div.posting-card'):
loader = ItemLoader(ZonapropItem(),casa)
loader.add_??? ('link', '???')
yield loader.load_item()
谢谢你的回答
您好(:您可以继续上一个问题
有两种方法:
loader.add_value()
方法。例如:这很简单
MapCompose
,它会将参数中的函数应用于使用CSS选择器找到的每个提取项:相关问题 更多 >
编程相关推荐