Created
March 29, 2012 16:16
-
-
Save vssun/2239178 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 -*- | |
""" | |
ഉപയോക്താക്കളുടെ താളുകളിൽ സന്ദേശങ്ങൾ ചേർക്കുന്നതിന് | |
(പ്രത്യേകിച്ച്, സംഗമത്തിന് സ്വാഗതം ചെയ്യാൻ) | |
നിർമ്മിച്ചത്: സുനിൽ വി.എസ്. | |
തിയതി: 2012-03-28 | |
പതിപ്പ് 2.0 | |
""" | |
import wikipedia | |
import codecs | |
#പ്രധാന പ്രോഗ്രാം ഇവിടെ തുടങ്ങുന്നു. | |
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു താഴെ വരുത്തുക | |
siteFamily = 'wikisource' | |
siteLangCode = 'ml' | |
pageListFileName = "userlist.txt" #ഉപയോക്താക്കളുടെ പട്ടിക, API ഉപയോഗിച്ച് ഉണ്ടാക്കിയത് | |
textToAdd=u"\n{{subst:ഉപയോക്താവ്:VsBot/conf}}--'''[[w:വിക്കിപീഡിയ:വിക്കിസംഗമോത്സവം - 2012/സമിതികൾ#സംഘാടക സമിതി|വിക്കിസംഗമോത്സവം സംഘാടകസമിതിക്കുവേണ്ടി]] ~~~~" | |
commentToAdd=u"സംഗമോൽസവത്തിലേക്ക് സ്വാഗതം" | |
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു മുകളിൽ വരുത്തുക | |
myFile=codecs.open(pageListFileName,encoding='utf-8') | |
wikiSite = wikipedia.Site(code=siteLangCode, fam=siteFamily) | |
for myLine in myFile: | |
myPage=wikipedia.Page(site=wikiSite,title="user_talk:" + myLine) | |
wikipedia.output(myPage.title()) | |
try: | |
if myPage.exists(): | |
if not myPage.isRedirectPage(): | |
myPage.put(myPage.get()+textToAdd,comment=commentToAdd,minorEdit=False) | |
else: | |
myPage.put(textToAdd,comment=commentToAdd,minorEdit=False) | |
except wikipedia.LockedPage: | |
wikipedia.output("no edits made on " + myPage.title()) | |
continue | |
myFile.close() | |
wikipedia.stopme() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment