You have to install BeautifulSoup from. You can install it with pip. (I tried on Ubuntu 14.04 LTS)
$ pip install beautifulsoup4
Download
Now let’s start cording.
As usual you have to import necessary libraries.
from google import search
import urllib
Now we read line for what we need to search. You can enter some key words.
whatToSearch = raw_input(“Enter a phrase to search:”)
whatToSearch = whatToSearch+” “+”filetype:jpg” # here we define the file type to search
stopAt = 10
SearchResult = search(whatToSearch, stop=stopAt)
Search will give you many thing. Out of that let’s print urls to searched pictures.
for url in SearchResult:
print url
You can download the source code Here.
Search JPEG Images on the Internet Using Python 2.X