Revision: 6674 Author: shizhao Date: 2009-04-22 18:31:25 +0000 (Wed, 22 Apr 2009)
Log Message: ----------- add new parameter: "-gorandom". Specifies that the robot should starting at the random pages returned by [[Special:Random]].
Modified Paths: -------------- trunk/pywikipedia/pagegenerators.py
Modified: trunk/pywikipedia/pagegenerators.py =================================================================== --- trunk/pywikipedia/pagegenerators.py 2009-04-22 18:00:51 UTC (rev 6673) +++ trunk/pywikipedia/pagegenerators.py 2009-04-22 18:31:25 UTC (rev 6674) @@ -131,6 +131,9 @@ [[Special:Randomredirect]]. Can also be given as "-randomredirect:n" where n is the number of pages to be returned, else 100 pages are returned. + +-gorandom Specifies that the robot should starting at the random pages + returned by [[Special:Random]]. """
@@ -1009,6 +1012,14 @@ transclusionPageTitle)) gen = ReferringPageGenerator(transclusionPage, onlyTemplateInclusion=True) + elif arg.startswith('-gorandom'): + for firstPage in RandomPageGenerator(number = 1): + firstPageTitle = firstPage.title() + namespace = wikipedia.Page(site, firstPageTitle).namespace() + firstPageTitle = wikipedia.Page(site, + firstPageTitle).titleWithoutNamespace() + gen = AllpagesPageGenerator(firstPageTitle, namespace, + includeredirects=False) elif arg.startswith('-start'): if arg.startswith('-startxml'): wikipedia.output(u'-startxml : wrong parameter')
pywikipedia-svn@lists.wikimedia.org