title: Error in Building WebScraper: TypeError: 'NoneType' object has no attribute '__getitem__'
body: <p>Am building a webscraper that displays top urls for web trends. However am always returned with the following error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:\Ceryx\webSearch.py", line 21, in &lt;module&gt;
      topl=webScraper(m)
    File "D:\Ceryx\webSearch.py", line 12, in webScraper
      hot = data['results'][0]['url']
  TypeError: 'NoneType' object has no attribute '__getitem__'
  </code></pre>
  
  <p>Help!!</p>
  
  <pre><code>import re
  import json
  import urllib, urllib2
  
  def webScraper(trends):
      query=urllib.urlencode({'q':trends})
      url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;%s' % query
      response = urllib.urlopen(url)
      extract = response.read()
      results = json.loads(extract)
      data = results['responseData']
      hot = data['results'][0]['url']
      return hot
  
  response = urllib2.urlopen('http://www.google.com/trends/hottrends/atom/hourly')
  html = response.read()
  matchObj = re.findall(r'&lt;a[^&gt;]*?&gt;(.*?)&lt;/a&gt;', html)
  
  print "Urls"
  for m in matchObj:
      topl=webScraper(m)
      print m,topl
  </code></pre>