Skip to content

Instantly share code, notes, and snippets.

@vssun
Created April 5, 2012 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vssun/2311208 to your computer and use it in GitHub Desktop.
Save vssun/2311208 to your computer and use it in GitHub Desktop.
താളുകളുടെ പട്ടിക, ഉപതാളുകൾ ഒഴിവാക്കി എടുക്കാൻ വിക്കിഗ്രന്ഥശാലക്കായി.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
താളുകളുടെ പട്ടിക, ഉപതാളുകൾ ഒഴിവാക്കി എടുക്കാൻ
വിക്കിഗ്രന്ഥശാലക്കായി.
നിർമ്മിച്ചത്: സുനിൽ വി.എസ്.
തിയതി: 2012-04-04
"""
import wikipedia
import pagegenerators
#പ്രധാന പ്രോഗ്രാം ഇവിടെ തുടങ്ങുന്നു.
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു താഴെ വരുത്തുക
siteFamily = 'wikisource'
siteLangCode = 'ml'
resultPage = ur'user:vssun/test' #ഫലം എവിടെത്തരണം?
#ആവശ്യത്തിനനുസരിച്ച് മാറ്റങ്ങൾ ഇതിനു മുകളിൽ വരുത്തുക
wikiSite = wikipedia.Site(code=siteLangCode, fam=siteFamily)
myCount=0
myText=u""
for myPage in pagegenerators.AllpagesPageGenerator(includeredirects=False):
myTitle=myPage.title()
if myTitle.count(u'/')>0:
wikipedia.output(myTitle + " is a subpage")
else:
myText=myText+"# [[" + myTitle + "]]\n"
myCount=myCount+1
wikipedia.output(u"Total Pages " + str(myCount))
#ഫലം വിക്കിയിലേക്കെഴുതാൻ
myResultPage=wikipedia.Page(site=wikiSite,title=resultPage)
myResultPage.put(myText,comment=ur"താളുകളുടെ പട്ടിക")
wikipedia.stopme()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment