Code Monkey home page Code Monkey logo

Comments (13)

ohyicong avatar ohyicong commented on August 22, 2024 1

I will update this source code to do this automatically

from google-image-scraper.

Jan-Oliver avatar Jan-Oliver commented on August 22, 2024 1

FYI:
The method mentioned above didn't work for me, as the screen went from a "Accept all" popup into a whole "Accept all" screen. I thus had to add

def find_image_urls(self):
        """
            This function search and return a list of image urls based on the search key.
            Example:
                google_image_scraper = GoogleImageScraper("webdriver_path","image_path","search_key",number_of_photos)
                image_urls = google_image_scraper.find_image_urls()

        """
        print("[INFO] Gathering image links")
        self.driver.get(self.url)
        ...
        accept_all_button_xpath = '//*[@id="yDmH0d"]/c-wiz/div/div/div/div[2]/div[1]/div[3]/div[1]/div[1]/form[2]/div/div/button'
        self.driver.find_element_by_xpath(accept_all_button_xpath).click()

I hope this helps somebody!

from google-image-scraper.

csmit86 avatar csmit86 commented on August 22, 2024

Ah, I just realize it downloads the images after all the links are obtained.

from google-image-scraper.

ItsGoldeneyes avatar ItsGoldeneyes commented on August 22, 2024

Ah, I just realize it downloads the images after all the links are obtained.

You got it, what license agreement popup are you referring to? Is this something that's an issue or did you find a solution?

from google-image-scraper.

csmit86 avatar csmit86 commented on August 22, 2024

Like when you use Chrome in Incognito mode, and google something, you get a pop-up asking to agree to google's terms. The only way I managed to bypass it is by running the script with headless = false and decline the agreement manually. But then I can't use my pc while the script is running. It stops when I minimise the browser.

from google-image-scraper.

ItsGoldeneyes avatar ItsGoldeneyes commented on August 22, 2024

Like when you use Chrome in Incognito mode, and google something, you get a pop-up asking to agree to google's terms. The only way I managed to bypass it is by running the script with headless = false and decline the agreement manually. But then I can't use my pc while the script is running. It stops when I minimise the browser.

I've never seen that popup before, could be a region issue. What country are you in?

from google-image-scraper.

csmit86 avatar csmit86 commented on August 22, 2024

The Netherlands

from google-image-scraper.

ohyicong avatar ohyicong commented on August 22, 2024

I suspect it may be a regional issue. I'm unable to replicate this issue.

from google-image-scraper.

ohyicong avatar ohyicong commented on August 22, 2024

I think you might be able to load your chrome profile into selenium to resolve this issue

from google-image-scraper.

mooujarrar avatar mooujarrar commented on August 22, 2024

Hi,

In the function GoogleImageScraper after the line
driver.get("https://www.google.com")
you can add:
driver.find_element(By.ID, "L2AGLb").click()

That should bypass the chrome popup by clicking on the Accept all button.
I will push that fix if you confirm that it works for you.

from google-image-scraper.

meron1122 avatar meron1122 commented on August 22, 2024

@mooujarrar It works :)

from google-image-scraper.

muhammad-mobeen avatar muhammad-mobeen commented on August 22, 2024

The popup usually occurs while trying to search flagged or age-restricted content; hence, Google asks for the agreement.
Good thing @mooujarrar solved it.

from google-image-scraper.

juanla avatar juanla commented on August 22, 2024

Hi,

In the function GoogleImageScraper after the line driver.get("https://www.google.com") you can add: driver.find_element(By.ID, "L2AGLb").click()

That should bypass the chrome popup by clicking on the Accept all button. I will push that fix if you confirm that it works for you.

@mooujarrar, Works for me too, thanks.

from google-image-scraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.