diff options
author | Sean B. Palmer <http://inamidst.com/sbp/> | 2008-02-29 15:36:18 +0000 |
---|---|---|
committer | Sean B. Palmer <http://inamidst.com/sbp/> | 2008-02-29 15:36:18 +0000 |
commit | 3d920f431789ac53596933785b5fe61463335e3b (patch) | |
tree | 654b01dfb141aba551d400393263fa6914ba9310 /modules/wikipedia.py | |
parent | cbdf9ebd7312bf570a212057ad793ae520bac38f (diff) | |
download | bot-3d920f431789ac53596933785b5fe61463335e3b.tar.gz bot-3d920f431789ac53596933785b5fe61463335e3b.tar.bz2 bot-3d920f431789ac53596933785b5fe61463335e3b.zip |
Some more little fixes, and added a Makefile.
Diffstat (limited to 'modules/wikipedia.py')
-rw-r--r-- | modules/wikipedia.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/wikipedia.py b/modules/wikipedia.py index 0a0a415..696bce4 100644 --- a/modules/wikipedia.py +++ b/modules/wikipedia.py @@ -55,6 +55,7 @@ def search(term): else: return term def wikipedia(term, last=False): + global wikiuri bytes = web.get(wikiuri % urllib.quote(term)) bytes = r_tr.sub('', bytes) @@ -83,7 +84,8 @@ def wikipedia(term, last=False): and not 'disambiguation)"' in para) and not '(images and media)' in para and not 'This article contains a' in para - and not 'id="coordinates"' in para] + and not 'id="coordinates"' in para + and not 'class="thumb' in para] for i, para in enumerate(paragraphs): para = para.replace('<sup>', '|') @@ -119,7 +121,9 @@ def wikipedia(term, last=False): return None sentence = '"' + sentence.replace('"', "'") + '"' - return sentence + ' - ' + (wikiuri % term) + sentence = sentence.decode('utf-8').encode('utf-8') + wikiuri = wikiuri.encode('utf-8') + return sentence + ' - ' + (wikiuri % term.encode('utf-8')) def wik(phenny, input): origterm = input.groups()[1] |