Trying to crawl through google search results. This code works pretty well with all the other sites, I have tried, however not working with google. It returns an empty list.
from BeautifulSoup import BeautifulSoup
import requests
def googlecrawler(search_term):
url="https://www.google.co.in/?gfe_rd=cr&ei=UVSeVZazLozC8gfU3oD4DQ&gws_rd=ssl#q="+search_term
junk_code=requests.get(url)
ok_code=junk_code.text
good_code=BeautifulSoup(ok_code)
best_code=good_code.findAll('h3',{'class':'r'})
print best_code
googlecrawler("healthkart")
It should return something like this.
<h3 class="r"><a href="/url? sa=t&rct=j&q=&esrc=s&source=web&cd=6&cad=rja&uact=8&ved=0CEIQFjAF&url=http%3A%2F%2Fwww.coupondunia.in%2Fhealthkart&ei=qFmfVc2fFNO0uASti4PwDQ&usg=AFQjCNFHMzqn-rH4Hp-fZK0E4wwxJmevEg&sig2=QgwxMBdbPndyQTSH10dV2Q" onmousedown="return rwt(this,'','','','6','AFQjCNFHMzqn-rH4Hp-fZK0E4wwxJmevEg','QgwxMBdbPndyQTSH10dV2Q','0CEIQFjAF','','',event)" data-href="http://www.coupondunia.in/healthkart">HealthKart Coupons: July 2015 Coupon Codes</a></h3>