Basic Google search using a shell script
- by Lri
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?