Giter VIP home page Giter VIP logo

image-scrapping-with-python-and-selenium's Introduction

Image-Scrapping-with-python-and-selenium

A python codebase that downloads images from Google Browser with the search term mentioned.

The above code base is written in python and downloads images from Google with the search term of your choice.

Table of contents

Setup:

1. Steps for setting up Google Chrome browser driver:

  1. Install Google Chrome (skip if its already installed).

  2. Identify your Chrome version by typing below command.

 $ google-chrome --version
 

and displays like this

  Google Chrome 81.0.4044.122
 
  1. Download corresponding ChromeDriver from below link.
  1. Unzip the chromedriver.zip

  2. Move the file to /usr/bin directory

 $ sudo mv chromedriver /usr/bin
 

then move to below folder

 $ cd /usr/bin
 
  1. Now, you would need to run something like
 $ sudo chmod a+x chromedrive
 

and mark it executable.

2. Steps to download required packages

  1. Clone the code and open the terminal and type the following command
 $ bash requirements.sh
 

the above file will download all the required images

Running

After downloading the required packages The code has two parts

  1. Searching for a specific term & get image links
  2. Downloading the images

The function find_and_download expects four input parameters:

search_term : Search term, like Cat
driver_path : instantiated Webdriver
target_path : images folder
number_images : No of images to download

Eg: find_and_download(search_term ="Cat", \
                        driver_path = "/usr/bin/chromedriver", \
                        target_path='./images', \
                        number_images=100)

Make the above changes in code and save it

  1. Finally run the below command to run the script
$ python3 scrap_image.py

  1. After running the above code, the code automates to open Google browser as below

Then the images in stored in cat folder as below

Through above code you can download image with search_term of your choice
Happy Downloading !!

image-scrapping-with-python-and-selenium's People

Contributors

ambika-gowda avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

singh08prashant

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.