Python谷歌图片下载不起作用

2024-04-20 00:28:29 发布

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

我正在通过谷歌图像下载程序抓取图像。 最初有效的代码开始突然停止工作 我们如何解决这个问题?代码和错误消息如下所示

from google_images_download import google_images_download   

def ImageCrawling(keyword, dir):
    response = google_images_download.googleimagesdownload()  

    arguments = {"keywords":keyword 
        ,"limit":2 
        ,"print_urls":True 
        ,'output_directory':dir}   
    paths = response.download(arguments)   #passing the arguments to the function
    print(paths)   #printing absolute paths of the downloaded images

ImageCrawling('dog','C:\\nuguya')


Tags: the代码图像程序responsedownload错误dir
2条回答

谷歌最近似乎从页面中删除了rg_metadata,这就是google_images_download用来处理原始html中的图像的地方。 就这样,它坏了

尝试从Ubuntu终端运行py文件。它很好用。我认为它在Windows操作系统中不起作用

相关问题 更多 >