Updated the Wikipedia search component.

master
Sean B. Palmer 2008-03-02 14:17:07 +00:00
parent 23c1dffa10
commit d7e909a061
1 changed files with 2 additions and 2 deletions

View File

@ -43,13 +43,13 @@ def text(html):
return unescape(html).strip() return unescape(html).strip()
def search(term): def search(term):
try: import google try: import search
except ImportError, e: except ImportError, e:
print e print e
return term return term
term = term.replace('_', ' ') term = term.replace('_', ' ')
try: uri = google.google('site:en.wikipedia.org %s' % term) try: uri = search.result('site:en.wikipedia.org %s' % term)
except IndexError: return term except IndexError: return term
if uri: if uri:
return uri[len('http://en.wikipedia.org/wiki/'):] return uri[len('http://en.wikipedia.org/wiki/'):]