title: No JSON object could be decoded with google API
body: <p>My python script is searching thought google pages for specific things. Like paths in url for example. Here is my code</p>
  
  <pre><code>import urllib2
  import urllib
  import json
  
  def search(target):
          num_queries = 50 * 4
          for start in range(0, num_queries, 4):
                  dork = 'intext: hacking'
                  dork = urllib.urlencode({'q' : dork})
                  url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;%s' % dork
                  for start in range(0, num_queries, 4):
                          request_url = '{0}&amp;start={1}'.format(url, start)
                          search_results = urllib.urlopen(request_url)
                          #try:
                          j = json.loads(search_results.read())
                          #except ValueError:
                          #print "Error: "
                                  #continue
                          results = j['responseData']['results']
                          for result in results:
                                  title = result['title']
                                  url = result['url']
                                  if target in url:
                                          print ( '[*]' + url )
  
  def main():
          target = raw_input("Enter target &gt;&gt; ")
          search(target)
  
  
  if __name__ ==  "__main__":
          main()
  </code></pre>
  
  <p>After the 3rd result I'm getting No JSON object could be decoded. Here is the whole error:</p>
  
  <pre><code>Enter target &gt;&gt; .com
  [*]some site
  [*]some site
  [*]some site
  Traceback (most recent call last):
    File "gs.py", line 32, in &lt;module&gt;
      main()
    File "gs.py", line 28, in main
      search(target)
    File "gs.py", line 15, in search
      j = json.loads(search_results.read())
    File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
      raise ValueError("No JSON object could be decoded")
  ValueError: No JSON object could be decoded
  </code></pre>
  
  <p>Any idea from where the error is coming and how to fix it?</p>