From 30f6ead29281342fd3d8ee96cf1b4878124b8d1e Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Mon, 1 Feb 2010 21:52:09 -0700 Subject: [PATCH] fix wolfralpha scraping when a pod is empty --- plugins/wolframalpha.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/wolframalpha.py b/plugins/wolframalpha.py index 93292ab..d2b8f37 100644 --- a/plugins/wolframalpha.py +++ b/plugins/wolframalpha.py @@ -22,7 +22,12 @@ def wolframalpha(inp): pod_texts = [] for pod in pods: - heading = pod.find('h1/span').text_content().strip() + heading = pod.find('h1/span') + if heading is not None: + heading = text_content().strip() + else: + continue + results = [] for image in pod.xpath('div/div[@class="output"]/img'): alt = image.attrib['alt'].strip()