Updated the Wikipedia search component.

This commit is contained in:
Sean B. Palmer
2008-03-02 14:17:07 +00:00
parent 23c1dffa10
commit d7e909a061

View File

@@ -43,13 +43,13 @@ def text(html):
return unescape(html).strip()
def search(term):
try: import google
try: import search
except ImportError, e:
print e
return term
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
if uri:
return uri[len('http://en.wikipedia.org/wiki/'):]