Planning the future of Botwiki! - Help us bring Botwiki up to date, contribute to our strategy discussion, add bot scripts, and contribute manuals, guides, and tutorials! Almost anything related to bots, particularly those used to edit mediawiki, is welcome.
UNABLE TO EDIT? - We've experienced attacks by spambots lately and now require you to confirm your e-mail before you can edit (go to your preferences, enter an e-mail address, and request a confirmation e-mail, then go to your e-mail and click on the confirmation link). We also require new accounts to make a few edits and wait a few minutes before before you can create a page; however, if this is a problem contact us in #botwiki and we can manually confirm your account. Sorry for the inconvenience.
Python:ScanCancellate.py
This bot is used to look for previous delections of new pages
#!/usr/bin/python #! -*- coding: utf-8 -*- # Author: Lusum # License: GPL2 # Description: Program to find if a new page has been already deleted """ You can run the bot with the following commandline parameters: -new - Choose the number of new pages to analyze Examples: python scanCancellate.py -new:60 #exam 60 new pages """ import wikipedia, pagegenerators import query def get_log_delete( title ): params = { 'action' :'query', 'list' :'logevents', 'letype' :'delete', 'letitle' :title, 'leprop' :'timestamp|comment|type', } results = query.GetData(params, useAPI = True, encodeTitle = False) events = results['query']['logevents'] return events def pagina_da_esaminare( title ): templista = [] events = get_log_delete( title ) for res in events: comment = res['comment'] if comment.find('semplificata') != -1: wikipedia.output("\03{lightred}Cancellata in semplificata %s \n" % ( title )) if comment.find('C4') != -1: wikipedia.output("\03{lightred}Cancellata promozionale %s \n" % ( title )) if comment.find('C7') != -1: wikipedia.output("\03{lightred}Cancellata reinserita %s \n" % ( title )) def main(): gen = None # Number of pages to load at a time by Preload generator pageNumber = 40 # Default number of pages for NewPages generator number = 60 # Which namespaces should be processed? # default to [] which means all namespaces will be processed namespaces = [] genFactory = pagegenerators.GeneratorFactory() args = wikipedia.handleArgs() for arg in args: if arg.startswith('-new'): if len(arg) >=5: number = int(arg[5:]) gen = pagegenerators.NewpagesPageGenerator(number = number) # Preload generator work better if 'pageNumber' is not major than 'number', # this avoid unnecessary delay. if number < pageNumber: pageNumber = number if namespaces != []: gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces) preloadingGen = pagegenerators.PreloadingGenerator(gen, pageNumber = pageNumber) for page in preloadingGen: try: # Load the page's text from the wiki wikipedia.output(page.title()) except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % page.title()) continue except wikipedia.IsRedirectPage: newpage = page.getRedirectTarget() wikipedia.output(u'Page %s redirect to \'%s\'' % (page.aslink(), newpage.title())) continue if page.isDisambig(): wikipedia.output(u'Page %s is a disambiguation page' % page.aslink()) continue pagina_da_esaminare( page.title() ) if __name__ == "__main__": try: main() finally: wikipedia.stopme()