_find() method (using ajax api) added to google module

This commit is contained in:
Rolux 2009-07-04 12:37:25 +02:00
parent e01af3fdd7
commit bb8db87d02
1 changed files with 26 additions and 19 deletions

View File

@ -7,6 +7,8 @@ import urllib2
import weakref
import threading
import Queue
import simplejson
import oxlib
from oxlib import stripTags
@ -48,3 +50,8 @@ def find(query, max_results=DEFAULT_MAX_RESULTS):
results = results[:max_results]
return results
def _find(query):
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%s' % quote_plus(query)
results = simplejson.loads(getUrlUnicode(url))['responseData']['results']
return results