-
-
Save nickedes/972605b2656f0234e7f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import hashlib | |
def getPic(search): | |
#replace spaces by %20 for searching | |
search = search.replace(" ","%20") | |
url = "https://www.google.com/search?site=imghp&tbm=isch&source=hp&biw=1414&bih=709&q="+search+"&oq="+search | |
r = requests.get(url) | |
data = r.text | |
soup = BeautifulSoup(data) | |
results = soup.findAll("img") | |
for r in results: | |
print "%(src)s" % r | |
getPic("cars and music") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment