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

Cannot download more than 20 images #383

Open sharitsang opened 11 months ago

sharitsang commented 11 months ago

Initially I had the same problem from this issue about not being able to download anything even though it can run. Someone was able to provide a patch to that problem, so I used that and it runs fine and can download images.

But now, no matter what number I put the limit at above 20 (I need to download around 1000 images), only 20 images can be downloaded.

With a command like this: python3 google_images_download.py --keywords "Hong Kong" -sk "car, minibus, truck, motorcycle, taxi" --limit 1000

It ends up looking something like this:

Item no.: 1 --> Item name = Hong Kong  minibus
Evaluating...
Starting Download...
Completed Image ====> 1.ANd9GcRBCOtKuddaIWjVoSR_qY7s_30bAfKVL5egkmpuA3V1J335JTk1gvXhXhM0crU.jpg
Completed Image ====> 2.ANd9GcTSp5yed9MH1HsvQE9VUyKLSCk4XalyRdVIpUeddC6NuJV2maKVjAQ6R9GtgyE.jpg
Completed Image ====> 3.ANd9GcQZtDoxzO0Zth8a4wyP6pqul_TbB8HsA6HMlp.jpg
Completed Image ====> 4.ANd9GcSiISw4sqrvOwgnL8HM0p3jXaStuKna2eCLektmoRORMEKtTi0KmcHAsXVkxA.jpg
Completed Image ====> 5.ANd9GcQ6fhgk41zd6aGzRKP63vQR2SIdh_gz7rrXRtBzdVXltvbzwQOlz31Q0Px5gg.jpg
Completed Image ====> 6.jvRPhUImw__5hZX1oVXlyZPNGvU2IlwjMv99Q_2nQnQdyA.jpg
Completed Image ====> 7.ANd9GcSsLdKM1bwOknKJNuUZeCxvF1dfvvJqJwMXhmVWHjBVHfo5O9O0jFHVgwjWCuo.jpg
Completed Image ====> 8.ANd9GcTjrKJyxeL1zyMYTehT4AcEAPWnUX1.jpg
Completed Image ====> 9.ANd9GcTP8xFWLqHeqUHqdB5sRSS0GMUeptiJG8.jpg
Completed Image ====> 10.ANd9GcR8UamihmI45RPzQ2nYAXLRpbKA3DrUIcrmXs6o9a0wQOCQ7E4wMhFYEdBfqg.jpg
Completed Image ====> 11.fy_TxNbQOHFtNHQvXNWaS88DEVoLPQuCaIiVUyfySUDyI3Q.jpg
Completed Image ====> 12.ANd9GcSxBqsBcH2iEljID8XHvSVyxCu1iK1zCCL4pO8yab.jpg
Completed Image ====> 13.ANd9GcS3VAz2xVfeOwetkX4OU81vB9tSHTlwn.jpg
Completed Image ====> 14.ANd9GcQtL_ZP5rhcig6gswItfUrLHPgdzX.jpg
Completed Image ====> 15.ANd9GcS9uLDHVZ1rUx7SWj5Pgir2jrE3i9ouOFxztAupUfWZgYIhewgOut2xY3lp_Zo.jpg
Completed Image ====> 16.ANd9GcS2wX9ejOSYQQztCTbLx0FF0Fo0hyba7siISJuNSRNq75m8CPKZra4fqceRFC0.jpg
Completed Image ====> 17.ANd9GcTA9BaqrByt2rXljZwIxJfFD4Xl9ggMQAsBptL.jpg
Completed Image ====> 18.ANd9GcQn__AcmHqkaVDuVEU7ICvPc7lQnc2nsqui0reg8SjsjNqqimz6n.jpg
Completed Image ====> 19.FWjofnDcy9KeEojTWk94kqQ.jpg
Completed Image ====> 20.ANd9GcR2Pddb8Ylhd2IzDapzmld9BGMgwVg220X3LjuijC.jpg

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

Errors: 0

Everything downloaded!
Total errors: 0

I also tried it with a smaller number above 20 and the same thing happened where only 20 can be downloaded. python3 google_images_download.py --keywords "Hong Kong taxi" --limit 22

Result:

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

Errors: 0

Everything downloaded!
Total errors: 0
Sauravroy34 commented 6 months ago

Maybe because of the dynamic nature of the website one solution can be to use windowscroll of selenium which can scroll down and find more images.