Created
November 9, 2011 01:47
-
-
Save vssun/1350055 to your computer and use it in GitHub Desktop.
താളുകളിൽ നടന്ന തിരുത്തലുകളുടെ എണ്ണം കണ്ടെത്താൻ (വിക്കിപീഡിയ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
താളുകളിലെ തിരുത്തലുകളുടെ എണ്ണം കണ്ടെത്താൻ | |
നിർമ്മിച്ചത്: സുനിൽ വി.എസ്., സരയുവിനൊപ്പം | |
തിയതി: 2011-11-07 | |
""" | |
import wikipedia | |
import pagegenerators | |
#import catlib | |
#പ്രധാന പ്രോഗ്രാം ഇവിടെ തുടങ്ങുന്നു. | |
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു താഴെ വരുത്തുക | |
siteFamily = 'wikipedia' | |
siteLangCode = 'ml' | |
startPage = '!' | |
minimumRevisions= 20 #100 തിരുത്തുകളിൽ കൂടുതലുള്ള താളുകൾ മാത്രമേ നോക്കുകയുള്ളൂ. | |
numberOfPages = 5 #എത്ര താളുകളിൽ നോക്കണം? | |
outputPage = 'user:vssun/revisions' | |
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു മുകളിൽ വരുത്തുക | |
wikiSite = wikipedia.Site(code=siteLangCode, fam=siteFamily) | |
myOutputPage = wikipedia.Page(site=wikiSite,title=outputPage) | |
mySourceText = myOutputPage.get() | |
i=0 | |
myText="" | |
for myPage in pagegenerators.AllpagesPageGenerator(start =startPage, namespace=None, includeredirects=False, | |
site=wikiSite): | |
wikipedia.output("Working on " + myPage.title()) | |
myLength=len(myPage.getVersionHistory(revCount=5000)) | |
if myLength>minimumRevisions: | |
myText=myText+"|-\n|[["+myPage.title()+"]]||"+str(myLength)+"\n" | |
i=i+1 | |
if i>=numberOfPages: | |
break | |
wikipedia.output(myText) | |
myOutputPage.put(mySourceText[:-2] + myText + "\n|}") | |
wikipedia.stopme() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment