Updated the Wikipedia search component.
parent
23c1dffa10
commit
d7e909a061
|
@ -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/'):]
|
||||||
|
|
Loading…
Reference in New Issue