无法使用 xpath 获取所有图像

Unable to get all images using xpath

我正在尝试从 link https://www.residentialpeople.com/za/property/k2edgr-freehold/ 中获取所有图像,但我似乎无法获取任何图像。甚至为什么我尝试检查请求和 JavaScript 我也找不到它们的存储位置。有什么建议么? 提前谢谢你。

这是我最初的方法:

response.xpath('//div[@class="image-holder"]//@style').re(r'url\((.*)\);')

页面上 JSON 里面有你需要的一切:

import scrapy
import json

class ResidentialpeopleSpider(scrapy.Spider):
    name = 'residentialpeople'
    start_urls = ['https://www.residentialpeople.com/za/property/k2edgr-freehold/']

    def parse(self, response):
        data_raw = response.xpath('//script[@type="application/ld+json"]/text()').get()
        data = json.loads(data_raw)

        for image in data['@graph']['@graph'][0]['photo']:
            print(image['contentUrl'])