How do you use google's API to do a simple search in Python?

0 views
Skip to first unread message

Pinwheeler via StackOverflow

unread,
Dec 9, 2013, 9:53:47 PM12/9/13
to google-appengin...@googlegroups.com

I would love a nice, friendly example to help me out, or even a link to help me get started.

I'm baffled by google's "cloud application" interface and none of the search tutorials seem to readily point to vanilla google search. It seems they are overcomplicating and obfuscating.

I have a google dev account and I'm just trying to figure out what commands to put into python to get a search and return the URLs as a list like you can do in xgoogle, but more friendly to google and not liable to get banned.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/20485141/how-do-you-use-googles-api-to-do-a-simple-search-in-python

ziggear via StackOverflow

unread,
Dec 9, 2013, 10:08:47 PM12/9/13
to google-appengin...@googlegroups.com

Google Web Search API has deprecated, so Google AJAX API is recommended.

You can custom your search like this:

import json
import urllib2

search_line = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=hello'
response = urllib2.urlopen(search_line)
search_results = json.loads(response.read())
print(search_results['responseData']['results'])


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/20485141/how-do-you-use-googles-api-to-do-a-simple-search-in-python/20485267#20485267
Reply all
Reply to author
Forward
0 new messages