dongheehand / Google-Full-size-image-crawler

crawling google full size image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Full size image crawler

This repo is for crawling full size image in the google search.

Development Environment

  • WEB : Chrome Version 106.0.5249.91 (Official Build) (x86_64)
  • OS : MAC
  • IDE : Pycharm

Dependency

selenium == 4.4.3

How to use crawler

  1. Download suitable chrome driver.

    Follow this link.

  2. You should specify PATH in webdriver.Chrome()

     PATH="./chromedriver"
     driver = webdriver.Chrome(executable_path=PATH)
  3. You should specify full size image xpath in chorme.

    1. Do search img.png
    2. Go to inspect, and click upper left mouse icon. img_1.png
    3. click full size image, and go to inspect. img_2.png
    4. copy xpath. img_3.png
  4. replace copied xpath with copied variable.

     copied_xpath='//*[@id="Sva75c"]/div/div/div[3]/div[2]/c-wiz/div/div[1]/div[1]/div[3]/div/a/img'
  5. Run the code!.

    Follow command like this.

    python main.py
    
    Please enter a search term: jordon white white
    Enter the total number: 50

Example

Please enter a search term: pikachu
Enter the total number: 5
**************************************************Crawlling started.**************************************************
Image saved: pikachu_1.jpg
Image saved: pikachu_2.jpg
Image saved: pikachu_3.jpg
Image saved: pikachu_4.jpg
Image saved: pikachu_5.jpg
**************************************************Crawlling Completed.**************************************************

Output

pikachu.png

Info

  • I'm not sure but copied xpath can be reused for different search term.
  • I guess that when chrome is updated or google updated their search engine, we should copy again.

About

crawling google full size image


Languages

Language:Python 100.0%