Reputation: 341
I have been trying to get images, from slide bar, from this website:https://propertyfox.co.za/property/pf10434/ and I cannot seem to access the class, so I have decided to check the page source. However, I am still struggling, not sure what I'm doing wrong
this is how the code I have for now looks like but I always get an empty array:
images = response.xpath('//*[@class="pagination-item"]//*[has-class("total-slide")]/span/text()').extract()
Any suggestions? Thanks!
Upvotes: 0
Views: 153
Reputation: 2116
In the page-source you can see the image links are stored under id="galleryatts"
. The following xpath gets the images:
images = response.xpath('//*[@id="galleryatts"]/@data-allimg').extract_first()
That way you get all the images in a string, delimited by a semicolon. To get the images as a list you can simply do this:
image_urls = images.split(';')
Upvotes: 1