User:Ritchie333/unlinkedblps.py

  1. !/usr/bin/python

import re

import pywikibot

from pywikibot import pagegenerators

name = 'Category:All unreferenced BLPs'

reLinks = re.compile( '==.*External links.*==' )

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 = reLinks.search( text )

if( match is None ):

print( '* ' + title + '' )

count += 1

print( '( ' + str( count ) + ' entries )' )