擅长:python、mysql、java
<p>您尝试使用的类名似乎是动态生成的。这是它们在页面源中的方式:</p>
<pre><code><a href="https://static.propertylogic.net/properties/8/972/1900/929703/IMG_yPAH7LUOOusZs642oS1TjGTl9WIXaOUKWWMsXiSnL0luoixXTAyNV32n9kiM_hd.jpeg" class="fancybox-thumbs col-md-4 col-sm-6 col-xs-12" data-fancybox-group="property-images" style="margin-bottom: 10px; padding-right: 5px; padding-left: 5px;">
<div class="col-md-12" style="background: url('https://static.propertylogic.net/properties/8/972/1900/929703/IMG_yPAH7LUOOusZs642oS1TjGTl9WIXaOUKWWMsXiSnL0luoixXTAyNV32n9kiM_small.jpeg'); height: 160px; padding-right: 0px; padding-left: 0px; background-size: cover; background-position: center;"> </div>
</a>
</code></pre>
<p>您可以使用这两种方法中的任何一种来获取粗略的图像链接:</p>
<pre><code>for item in response.css('a[data-fancybox-group="property-images"] > [style^="background"]::attr(style)').getall():
yield {"image_link":item}
for item in response.xpath('//a[@data-fancybox-group="property-images"]/*[starts-with(@style,"background")]/@style').getall():
yield {"image_link":item}
</code></pre>