0
^
|
| this question DOES NOT HAVE an answer yet!

I am trying to do google search from python script.

xing = "site:xing.com inurl:profile intext:Systemadministrator AND UNIX AND Hamburg"
query = urllib.urlencode ( { 'q' : xing } )
response = urllib.urlopen ( 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&' + query ).read()
import json as m_json
json = m_json.loads ( response )
results = json [ 'responseData' ] [ 'results' ]
print len(results)

the problem is, it is giving me only 4 results. If i paste the search string in google, it is finding more than 100 results. what am i doing wrong here?

EDIT

i changed the code to this:

import urllib
import django.utils import simplejson
num_queries = 50*4 
xing = "site:xing.com inurl:profile intext:Systemadministrator AND UNIX AND Hamburg"
query = urllib.urlencode({'q' : xing})
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % query

for start in range(0, num_queries, 4):
    request_url = '{0}&start={1}'.format(url, start)
    search_results = urllib.urlopen(request_url)
    json = simplejson.loads(search_results.read())
    results = json['responseData']['results']
return HttpResponse(search_results)

i am receiving no data. search_results is empty. why is this?

doniyor
  • 36,596
  • 57
  • 175
  • 260

0 Answers0