我如何使用wget下载scrapy文件

2024-09-30 18:13:26 发布

您现在位置:Python中文网/ 问答频道 /正文

scrapy没有正确下载文件。我有我的项目的网址,所以我想我可以使用wget下载文件。在

如何在scrapyprocess_item函数中使用wget?或者,是否有其他下载文件的方式?在

class MyImagesPipeline(ImagesPipeline):
    #Name download version
    def image_key(self, url):
        image_guid = url.split('/')[-1]
        return 'full/%s' % (image_guid)

    def get_media_requests(self, item, info):
        if item['image_urls']:
            for image_url in item['image_urls']:
            # wget -nH image_ul -P  images/
            yield Request(image_url)

Tags: 文件项目函数imageselfurldef方式