python - 使用 google_images_download 下载图片时出错
问题描述
我正在尝试运行以下代码以使用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 并在这里找到了一个答案,但它对我不起作用。任何形式的帮助将不胜感激。
谢谢
解决方案
抱歉,这并不能完全解决您的问题,但我尝试使用 pip 在新的环境中安装此模块,使用文档中的示例,并从 Python 和终端遇到相同的问题。
我前往 Git 存储库,最近似乎对许多人来说它已经坏了https://github.com/hardikvasa/google-images-download/issues/325
有人在那里提到,这是在补丁 1 分支https://github.com/Joeclinton1/google-images-download中修复的
推荐阅读
- java - process.waitFor(timeout, timeUnit) 在指定时间后不退出进程
- javascript - Jest 使用 sqlite 返回表未找到错误
- node.js - nodejs docker环境中的create-react-app错误
- angular - 重新创建 Angular 服务并丢失数据
- outlook - Outlook 邮件 REST API 参考(2.0 版)
- python - Python中的多处理,变量赋值
- c++ - 关于纯 ECS(实体组件系统)和更新系统的问题
- google-cloud-platform - 如何从 Metabase 连接到 Google Cloud SQL 数据库(当 Metabase 在 Google Cloud Run 上运行时)
- angular - http拦截器的错误处理在Angular中不起作用
- docker - Docker swarm 定期重启主机上的所有容器