Python 如何使用scrapy下载amazon-s3图像

Python 如何使用scrapy下载amazon-s3图像,python,amazon-s3,scrapy,Python,Amazon S3,Scrapy,我正在尝试使用scrapy下载图像,但问题是,我找不到获取该图像url的路径。他们正在使用s3处理他们的图像。这就是为什么如果我输入view(response),我可以看到空白的图库。那么我如何获得路径或图像链接?这里是网站链接。请看一看 您可以使用以下xpath获取主映像:response.xpath('//meta[@property=“og:image”]')。extract_first() 如果您想要所有图像:图像的链接在html中存在,但在json结构中有点隐藏。以下代码将json结构

我正在尝试使用scrapy下载图像,但问题是,我找不到获取该图像url的路径。他们正在使用s3处理他们的图像。这就是为什么如果我输入view(response),我可以看到空白的图库。那么我如何获得路径或图像链接?这里是网站链接。请看一看

  • 您可以使用以下xpath获取主映像:
    response.xpath('//meta[@property=“og:image”]')。extract_first()
  • 如果您想要所有图像:图像的链接在html中存在,但在json结构中有点隐藏。以下代码将json结构加载到python字典中并收集图像链接:

我不明白你的问题。请发布与您的问题相关的代码。
import json
image_json = response.xpath('//*[@type="text/x-magento-init"][contains(text(), "mage/gallery/gallery")]/text()').extract_first().strip()
image_dict = json.loads(image_json)
images_data = image_dict['[data-gallery-role=gallery-placeholder]']['mage/gallery/gallery']['data']
image_urls = [image_data['img'] for image_data in images_data]