piotrantosz / google-arts-crawler

Google Arts & Culture high quality image downloader
GNU General Public License v3.0
100 stars 18 forks source link

If you're using non-standard chrome version [Windows] #11

Open rudolphos opened 5 years ago

rudolphos commented 5 years ago

You need to edit crawler.py script

binary_location - path to chromium browser executable_path- for chromedriver.exe location

add

from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.binary_location = "C:\Program Files (x86)\Google\Chrome Dev\Application\chrome.exe"
driver = webdriver.Chrome(options = options, executable_path="chromedriver.exe")
driver.get('http://google.com/')
print("Chrome Browser Invoked")
driver.quit()

change after def generate_image (because chrome_options is deprecated)

from

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
    chrome_options.add_argument('--headless')
    #chrome_options.add_argument('--disable-gpu')
    browser = webdriver.Chrome(options=chrome_options)

to

    options.add_experimental_option("mobileEmulation", mobile_emulation)
    options.add_argument('--headless')
    #chrome_options.add_argument('--disable-gpu')
    browser = webdriver.Chrome(options=options)
piotrantosz commented 5 years ago

Thanks for tip! Do you mind creating pull request? You should own that part of a code! Contribution is welcome :)

On Mon, Aug 5, 2019, 1:55 AM rudolphos notifications@github.com wrote:

You need to edit crawler.py script

binary_location - path to chromium browser executable_path - for chromedriver.exe location

add

from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions() options.binary_location = "C:\Program Files (x86)\Google\Chrome Dev\Application\chrome.exe" driver = webdriver.Chrome(options = options, executable_path="chromedriver.exe") driver.get('http://google.com/') print("Chrome Browser Invoked") driver.quit()

change (because chrome_options is deprecated)

options.add_experimental_option("mobileEmulation", mobile_emulation)
options.add_argument('--headless')
#chrome_options.add_argument('--disable-gpu')
browser = webdriver.Chrome(options=options)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Boquete/google-arts-crawler/issues/11?email_source=notifications&email_token=ACQVU3KUM7NY7TPZN6RTQDDQC5T5ZA5CNFSM4IJGQ2W2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDIOW5A, or mute the thread https://github.com/notifications/unsubscribe-auth/ACQVU3PS4PWM4XEWIF5G7O3QC5T5ZANCNFSM4IJGQ2WQ .

rudolphos commented 5 years ago

It might break some things on other OSes.

options.binary_location = "" can be empty, then it selects default chrome installation, but leaving in executable_path="chromedriver.exe" might break script on linux.

This version is for windows, and only if chromedriver.exe is in the same folder as crawler.py.