Scrapy 在<;中获取背景图像或数据图像URL;李>;,用刮痧可以吗?

Scrapy 在<;中获取背景图像或数据图像URL;李>;,用刮痧可以吗?,scrapy,Scrapy,我只需要得到背景图像或数据图像的网址,它可能与刮 'imagem': response.xpath('//li[@id="propertyImageSlide"]').extract() “imagem”:[“\n\t\t\t\t\t\n\t\t\t\t”]} 'imagem': response.xpath('//li[@id="propertyImageSlide"]/@data-image').extract() # A bit more pre

我只需要得到背景图像或数据图像的网址,它可能与刮

'imagem': response.xpath('//li[@id="propertyImageSlide"]').extract()
“imagem”:[“
  • \n\t\t\t\t\t\n\t\t\t\t
  • ”]}

    'imagem': response.xpath('//li[@id="propertyImageSlide"]/@data-image').extract()
    
    # A bit more pretty with CSS selectors instead of Xpath
    
    'imagem': response.css('li#propertyImageSlide::attr(data-image)').extract()
    

    如果您试图获取
    数据图像
    属性值,请查看这是否与您要查找的内容相似:以及文档:如果您试图获取
    数据图像
    属性值,请查看这是否与您要查找的内容相似:以及文档:hy,mychael谢谢,但我需要取消背景图像:数据图像有一个_大小的字符串
  • hy,mychael谢谢,但我需要取消背景图像:数据图像有一个_大小的字符串
  • 'imagem': response.xpath('//li[@id="propertyImageSlide"]/@data-image').extract()
    
    # A bit more pretty with CSS selectors instead of Xpath
    
    'imagem': response.css('li#propertyImageSlide::attr(data-image)').extract()