Basic Google search using a shell script
Posted
by
Lri
on Stack Overflow
See other posts from Stack Overflow
or by Lri
Published on 2011-03-31T21:27:12Z
Indexed on
2012/04/11
11:29 UTC
Read the original article
Hit count: 237
Something like this but using just basic shell scripting:
#!/usr/bin/env python
import urllib
import json
base = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&'
query = urllib.urlencode({'q' : "something"})
response = urllib.urlopen(base + query).read()
data = json.loads(response)
print data['responseData']['results'][0]['url']
Any more convenient alternatives to ajax.googleapis.com? If not, how should you encode the URL and parse JSON?
© Stack Overflow or respective owner