From ec32741826e9cf039bf014f79fee0506f1ef6725 Mon Sep 17 00:00:00 2001
From: mutantmonkey ]*>.*? ')
-r_content = re.compile(r'(?ims)
]*>.*?
|]*>.*?
|') and - para.endswith('
')) - 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 'class="thumb' in para - and not 'There is currently no text in this page.' in para] - # and not 'style="display:none"' in para] - - for i, para in enumerate(paragraphs): - para = para.replace('', '|') - para = para.replace('', '|') - paragraphs[i] = text(para).strip() - - # Post-process - paragraphs = [para for para in paragraphs if - (para and not (para.endswith(':') and len(para) < 150))] - - para = text(paragraphs[0]) - m = r_sentence.match(para) - - if not m: - if not last: - term = search(term) - return uncyclopedia(term, last=True) - return None - sentence = m.group(0) - - maxlength = 275 - if len(sentence) > maxlength: - sentence = sentence[:maxlength] - words = sentence[:-5].split(' ') - words.pop() - sentence = ' '.join(words) + ' [...]' - - if (('using the Article Wizard if you wish' in sentence) - or ('or add a request for it' in sentence)): - if not last: - term = search(term) - return uncyclopedia(term, last=True) - return None - - sentence = '"' + sentence.replace('"', "'") + '"' - return sentence + ' - ' + (wikiuri % term) - -def uncyc(phenny, input): - origterm = input.groups()[1] - if not origterm: - return phenny.say('Perhaps you meant ".uncyc Zen"?') - origterm = origterm - - term = urllib.parse.unquote(origterm) - term = term[0].upper() + term[1:] - term = term.replace(' ', '_') - - try: result = uncyclopedia(term) - except IOError: - error = "Can't connect to uncyclopedia.wikia.com (%s)" % (wikiuri % term) - return phenny.say(error) - - if result is not None: - phenny.say(result) - else: phenny.say('Can\'t find anything in Uncyclopedia for "%s".' % origterm) - -uncyc.commands = ['uncyc'] -uncyc.priority = 'high' - -if __name__ == '__main__': - print(__doc__.strip()) diff --git a/modules/vtluugwiki.py b/modules/vtluugwiki.py index 2979113..3777b53 100644 --- a/modules/vtluugwiki.py +++ b/modules/vtluugwiki.py @@ -11,73 +11,34 @@ author: mutantmonkey]*>.*?
|]*>.*?
|]*>.*?
|