Jump to content

User:Ritchie333/afcbios.py

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ritchie333 (talk | contribs) at 20:20, 5 October 2018 (test script). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
#!/usr/bin/python

import sys
import re
import pywikibot
from pywikibot import pagegenerators

name = 'Category:AfC submissions declined as a non-notable biography'
reText = re.compile( '(She is|She was|Her work|Her book)' )

site = pywikibot.Site()
cat = pywikibot.Category(site,name)
gen = pagegenerators.CategorizedPageGenerator(cat)
for page in gen:
  ns = page.namespace()
  if( 118 == ns):
    text = page.text
    match = reText.search( text )
    if( match is not None ):
      title = page.title()
      print '[[' + title.encode( 'utf-8' ) + ']]'