ohyicong / Google-Image-Scraper

A library to scrap google images
378 stars 141 forks source link

Stops searching for image URLs #7

Closed insaiyancvk closed 2 years ago

insaiyancvk commented 2 years ago

When the code executes the following block

https://github.com/ohyicong/Google-Image-Scraper/blob/5fd2e59add64a9c03ef069b80d832bc10cd35911/GoogleImageScrapper.py#L86-L96

And it hits google's "Related searches" it stops the code. image

insaiyancvk commented 2 years ago

A little workaround I found was

self.driver.execute_script("window.scrollTo(0, "+str(indx*60)+");")

add this snippet at https://github.com/ohyicong/Google-Image-Scraper/blob/5fd2e59add64a9c03ef069b80d832bc10cd35911/GoogleImageScrapper.py#L91-L96 in this exception block

And remove everything else in this block https://github.com/ohyicong/Google-Image-Scraper/blob/5fd2e59add64a9c03ef069b80d832bc10cd35911/GoogleImageScrapper.py#L91-L98

ohyicong commented 2 years ago

Okay let me review the code

ohyicong commented 2 years ago

Okay I just fixed it.