Jump to content

User:Ritchie333/wirblps.py

From Wikipedia, the free encyclopedia
#!/usr/bin/python

import re
import pywikibot
from pywikibot import pagegenerators

name = 'Category:All unreferenced BLPs'
reCat = re.compile( '\[\[Category:[^\]]*(women|female|actress)[^\]]*\]\]' )

count = 0
site = pywikibot.Site()
cat = pywikibot.Category( site, name )
gen = pagegenerators.CategorizedPageGenerator( cat )
for page in gen:
    title = page.title( False, False )
    text = page.text
    match = reCat.search( text )
    if( match is not None ):
        print( '* [[' + title + ']]' )
        count += 1
print( '<small>( ' + str( count ) + ' entries )</small>' )