使用google_images_download下载图像时出错

2024-05-02 13:04:23 发布

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

我正在尝试运行以下代码以使用google_images_download包下载图像`

from google_images_download import google_images_download

response = google_images_download.googleimagesdownload()
arguments = {"keywords":"lilly,hills","limit":5,"print_urls":True}
paths = response.download(arguments)

print(paths)

例外输出如下所示

Image URL: https://assets.traveltriangle.com/blog/wp-content/uploads/2017/11/Hill-Stations-Near-Kolkata-cover1-400x267.jpg
Completed Image ====> 4.Hill-Stations-Near-Kolkata-cover1-400x267.jpg
Image URL: https://image.shutterstock.com/image-photo/distant-hills-hilly-steppe-curvy-260nw-1037414248.jpg
Completed Image ====> 5.distant-hills-hilly-steppe-curvy-260nw-1037414248.jpg
({'lilly': ['C:\\python3\\downloads\\lilly\\1.Lilly-Tougas.jpg', 
'C:\\python3\\downloads\\lilly\\2.1200px-Eli_Lilly_and_Company.svg.png', '
C:\\python3\\downloads\\lilly\\3.nikki-lilly-this-morning.jpg', 
'C:\\python3\\downloads\\lilly\\4.lily-plants.jpg', 
'C:\\python3\\downloads\\lilly\\5.dish-lilly-ghalichi.jpg'], 
'hills': ['C:\\python3\\downloads\\hills\\1.220px-Clouds_over_hills.jpg', 
'C:\\python3\\downloads\\hills\\2.Bacin_zari_2015.jpg', 
'C:\\python3\\downloads\\hills\\3.65ad9ac0-0455-4086-a4f4-1245f697d10e.png', 
'C:\\python3\\downloads\\hills\\4.Hill-Stations-Near-Kolkata-cover1-400x267.jpg', 
'C:\\python3\\downloads\\hills\\5.distant-hills-hilly-steppe-curvy-260nw-1037414248.jpg']}, 1)

但我得到的结果如下

Item no.: 1 --> Item name = lilly
Evaluating...
Starting Download...


Unfortunately all 5 could not be downloaded because some images were not downloadable. 0 is all we got for this search filter!

Errors: 0


Item no.: 2 --> Item name = hills
Evaluating...
Starting Download...


Unfortunately all 5 could not be downloaded because some images were not downloadable. 0 is all we got for this search filter!

Errors: 0

({'lilly': [], 'hills': []}, 0)

我搜索了关于同一问题的StackOverflow,找到了一个答案here,但它对我不起作用。我们将非常感谢您的任何帮助

谢谢


Tags: imagedownloaddownloadsgooglenotallitempython3
1条回答
网友
1楼 · 发布于 2024-05-02 13:04:23

很抱歉,这并不能完全解决您的问题,但我尝试使用pip在一个新的env中安装这个模块,使用情况与文档中的示例相同,并且从Python和terminal都遇到了相同的问题

我去了Git回购,最近似乎有很多人都破产了https://github.com/hardikvasa/google-images-download/issues/325

有人提到这在patch-1 branchhttps://github.com/Joeclinton1/google-images-download中是固定的

相关问题 更多 >