Jump to content

User:LemmeyBOT/LemmeyBot2

From Wikipedia, the free encyclopedia
import wikipedia, catlib, config, pagegenerators
import RefHistoryFix2
import category
import os, time
import string

class CategoryPages:


    def __init__(self, catTitle):
        self.cat = catlib.Category(wikipedia.getSite(), 'Category:' + catTitle)
     
    def run(self):
        listOfArticles = self.cat.articlesList()
        array = []

        f=open('woot.txt', 'r')
        text = f.readlines()
        f.close()

        LemmeyList = []
        pageTitle = u'User:Lemmey/L'
        Page = wikipedia.Page(wikipedia.getSite(), pageTitle)
        linked = Page.linkedPages()
        

        for article in linked:
            name = str(article).strip("[]")
            if name not in LemmeyList:LemmeyList.append(name)

        ##text = Page.get(throttle = False,get_redirect=True)
        for article in listOfArticles:
            if article.title() in LemmeyList:array.append(article.title())
                            
        print len(array), " articles"

        for title in array:
            try:
                run_job (title)
            except:
                pass	

		
def run_job(title):
    ##P_WAIT
    os.spawnv(os.P_WAIT,"C:\Python25\python.exe", ["python", "RefHistoryFix2.py " +'"' + title + '"'])

oldCatTitle = "Pages with incorrect ref formatting"
bot = CategoryPages(oldCatTitle)
bot.run()