Using module request and bs4 to crawler a number of image from google image when input a search string.
When we search somethings in the google image, the result is represented as a HTML file. Our duty is select the # img tag from this file, and download the # "src" atribute.
-
Install the nearest vesion of important module
pip install --upgrade requests pip install --upgrade beautifulsoup4 pip install --upgrade chardet
-
cd to path that you want to place your image
cd path/to/file
-
clone this repo
git clone https://github.com/trannhatkhoacm1612/Crawler
-
Run the crawler.py
You will call the download function and must input two parameters:
-
The string that to querry.
-
The interer number represented the number of img you want to download.
download("dog",10) # install 10 img with the querry "dog" in google img
-