[kupfer] google: Fix bug when no results are found



commit be4aa7e4f560f18acd5c436e20802d06606b7be3
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Feb 6 01:08:44 2010 +0100

    google: Fix bug when no results are found
    
    When no results are found, the estimated result count parameter is not
    there. We set it to 0.

 kupfer/plugin/google.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/google.py b/kupfer/plugin/google.py
index 89968f5..fd07ff4 100644
--- a/kupfer/plugin/google.py
+++ b/kupfer/plugin/google.py
@@ -57,7 +57,7 @@ class SearchResults (Source):
 		results = json_decoder(search_results)
 		data = results['responseData']
 		more_results_url = data['cursor']['moreResultsUrl']
-		total_results = data['cursor']['estimatedResultCount']
+		total_results = data['cursor'].get('estimatedResultCount', 0)
 		for h in data['results']:
 			yield UrlLeaf(h['url'], h['titleNoFormatting'])
 		yield CustomDescriptionUrl(more_results_url,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]