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
results = []
for image in pod.xpath('div/div[@class="output"]/img'):
alt = image.attrib['alt'].strip()
alt = alt.replace('\\n', '; ')
for alt in pod.xpath('div/div[@class="output pnt"]/img/@alt'):
alt = alt.strip().replace('\\n', '; ')
alt = re.sub(r'\s+', ' ', alt)
if alt:
results.append(alt)