fix wolframalpha scraping

This commit is contained in:
Ryan Hitchman 2010-09-22 21:25:25 -05:00
parent 31c0689628
commit f6207959ee
1 changed files with 2 additions and 3 deletions

View File

@ -26,9 +26,8 @@ def wolframalpha(inp):
continue continue
results = [] results = []
for image in pod.xpath('div/div[@class="output"]/img'): for alt in pod.xpath('div/div[@class="output pnt"]/img/@alt'):
alt = image.attrib['alt'].strip() alt = alt.strip().replace('\\n', '; ')
alt = alt.replace('\\n', '; ')
alt = re.sub(r'\s+', ' ', alt) alt = re.sub(r'\s+', ' ', alt)
if alt: if alt:
results.append(alt) results.append(alt)