fix wolfralpha scraping when a pod is empty
This commit is contained in:
parent
1dd86babc2
commit
30f6ead292
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue