Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import sys, os
- path = os.path.join(os.path.split(os.getcwd())[:-1][0])
- sys.path.append(path)
- import wikipedia as pywikilib, pagegenerators as pg
- def revisar_tota_la_Viqui(inici="!"):
- gen = pg.AllpagesPageGenerator(start=inici, namespace=0, includeredirects=False)
- try:
- for page in gen:
- #anirà passant totes els articles de cawiki com a objectes Page()
- pywikilib.output(page.title())
- #aquí podria anar la funció que vulgueres
- #funcio(page)
- except KeyboardInterrupt:
- raise KeyboardInterrupt("cancelled by user")
- if __name__ == '__main__':
- args = pywikilib.handleArgs()
- try:
- inici=None
- for arg in args:
- if arg.startswith("-ini:"):
- inici=arg[arg.index(":"):]
- pywikilib.output(u"comencem per: [[%s]]" % inici)
- revisar_tota_la_Viqui(inici)
- except KeyboardInterrupt:
- pywikilib.output(u"cancel·lat per l'usuari")
- finally:
- pywikilib.stopme()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement