Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
import jovian
!pip install google_images_download
Processing /home/rtx/.cache/pip/wheels/1f/28/ad/f56e7061e1d2a9a1affe2f9c649c2570cb9198dd24ede0bbab/google_images_download-2.8.0-py2.py3-none-any.whl
Requirement already satisfied: selenium in ./env/lib/python3.7/site-packages (from google_images_download) (3.141.0)
Requirement already satisfied: urllib3 in ./env/lib/python3.7/site-packages (from selenium->google_images_download) (1.25.7)
Installing collected packages: google-images-download
Successfully installed google-images-download-2.8.0
!googleimagesdownload
-------------------------------
Uh oh! Keywords is a required argument
Please refer to the documentation on guide to writing queries
https://github.com/hardikvasa/google-images-download#examples
exiting!
-------------------------------
!googleimagesdownload --keywords "Polar Bear" --limit 150
Item no.: 1 --> Item name = Polar Bear
Evaluating...
Looks like we cannot locate the path the 'chromedriver' (use the '--chromedriver' argument to specify the path to the executable.) or google chrome browser is not installed on your machine (exception: expected str, bytes or os.PathLike object, not NoneType)
!googleimagesdownload --keywords "Polar Bear" --limit 150 --chromedriver "/usr/bin/chromedriver"
Item no.: 1 --> Item name = Polar Bear
Evaluating...
Getting you a lot of images. This may take a few moments...
Reached end of Page.
Starting Download...
Completed Image ====> 1.Polar_Bear_-_Alaska_%28cropped%29.jpg
Completed Image ====> 2.polar-bear-hero.jpg
Invalid or missing image format. Skipping...
Completed Image ====> 3.tnc_17745326_preview-1260x708.jpg
^C
Traceback (most recent call last):
File "/home/rtx/work/webinar-7dec/env/bin/googleimagesdownload", line 8, in <module>
sys.exit(main())
File "/home/rtx/work/webinar-7dec/env/lib/python3.7/site-packages/google_images_download/google_images_download.py", line 998, in main
paths,errors = response.download(arguments) #wrapping response in a variable just for consistency
File "/home/rtx/work/webinar-7dec/env/lib/python3.7/site-packages/google_images_download/google_images_download.py", line 825, in download
paths, errors = self.download_executor(arguments)
File "/home/rtx/work/webinar-7dec/env/lib/python3.7/site-packages/google_images_download/google_images_download.py", line 952, in download_executor
items,errorCount,abs_path = self._get_all_items(raw_html,main_directory,dir_name,limit,arguments) #get all image items and download images
File "/home/rtx/work/webinar-7dec/env/lib/python3.7/site-packages/google_images_download/google_images_download.py", line 766, in _get_all_items
download_status,download_message,return_image_name,absolute_path = self.download_image(object['image_link'],object['image_format'],main_directory,dir_name,count,arguments['print_urls'],arguments['socket_timeout'],arguments['prefix'],arguments['print_size'],arguments['no_numbering'],arguments['no_download'],arguments['save_source'],object['image_source'],arguments["silent_mode"],arguments["thumbnail_only"],arguments['format'],arguments['ignore_urls'])
File "/home/rtx/work/webinar-7dec/env/lib/python3.7/site-packages/google_images_download/google_images_download.py", line 599, in download_image
response = urlopen(req, None, timeout)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/home/rtx/anaconda3/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 1384, in connect
super().connect()
File "/home/rtx/anaconda3/lib/python3.7/http/client.py", line 928, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/home/rtx/anaconda3/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
KeyboardInterrupt