hardikvasa / google-images-download

Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!
MIT License
8.57k stars 2.11k forks source link

JSONDecodeError: Extra Data #353

Closed matthewlehew closed 3 years ago

matthewlehew commented 3 years ago

I'm encountering this error on the latest version of #298 patch-1 provided by @joeclinton1, downloaded today. The package works perfectly so long as I'm downloading fewer than 100 images and not having to launch ChromeDriver. Any assistance would be appreciated!

googleimagesdownload -k "computer" -o "batch" --limit 200 --chromedriver ~/Developer/drivers/chromedriver

results in:

Item no.: 1 --> Item name = computer
Evaluating...
Getting you a lot of images. This may take a few moments...
Reached end of Page.
Traceback (most recent call last):
  File "/Users/owner/Developer/googleimages/venv/bin/googleimagesdownload", line 33, in <module>
    sys.exit(load_entry_point('google-images-download==2.8.0', 'console_scripts', 'googleimagesdownload')())
  File "/Users/owner/Developer/googleimages/venv/lib/python3.8/site-packages/google_images_download-2.8.0-py3.8.egg/google_images_download/google_images_download.py", line 1140, in main
  File "/Users/owner/Developer/googleimages/venv/lib/python3.8/site-packages/google_images_download-2.8.0-py3.8.egg/google_images_download/google_images_download.py", line 958, in download
  File "/Users/owner/Developer/googleimages/venv/lib/python3.8/site-packages/google_images_download-2.8.0-py3.8.egg/google_images_download/google_images_download.py", line 1085, in download_executor
  File "/Users/owner/Developer/googleimages/venv/lib/python3.8/site-packages/google_images_download-2.8.0-py3.8.egg/google_images_download/google_images_download.py", line 317, in download_extended_page
  File "/Users/owner/Developer/googleimages/venv/lib/python3.8/site-packages/google_images_download-2.8.0-py3.8.egg/google_images_download/google_images_download.py", line 196, in _extract_data_pack_ajax
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 104236 (char 104235)
matthewlehew commented 3 years ago

I think I found and fixed the problem with this pull request.