I am trying to get images from a Google Image search for a specific request. But the page that I load without photos redirects me to the original version of Google. Here is my code:
AGENT_ID = "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1" GOOGLE_URL = "https://www.google.com/images?source=hp&q={0}" _myGooglePage = "" def scrape(self, theQuery) : self._myGooglePage = subprocess.check_output(["curl", "-L", "-A", self.AGENT_ID, self.GOOGLE_URL.format(urllib.quote(theQuery))], stderr=subprocess.STDOUT) print self.GOOGLE_URL.format(urllib.quote(theQuery)) print self._myGooglePage f = open('./../../googleimages.html', 'w') f.write(self._myGooglePage)
What am I doing wrong?
thanks
source share