From b9f74dba719d42e1202581724f8cf6f4658c1a63 Mon Sep 17 00:00:00 2001 From: Chris Skalenda Date: Thu, 8 Jul 2010 19:18:25 -0600 Subject: [PATCH] Handle blank descriptions from google in the google search plugin. --- plugins/google.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/google.py b/plugins/google.py index 8fa1295..34d0b64 100644 --- a/plugins/google.py +++ b/plugins/google.py @@ -37,8 +37,14 @@ def google(inp): result = parsed['responseData']['results'][0] - title, content = map(lambda x: http.html.fromstring(x).text_content(), - (result['titleNoFormatting'], result['content'])) + + title = result['titleNoFormatting'] + content = result['content'] + + if len(content) == 0: + content = "No description available" + else: + content = http.html.fromstring(content).text_content() out = '%s -- \x02%s\x02: "%s"' % (result['unescapedUrl'], title, content) out = ' '.join(out.split())