Jump to content

User:Ritchie333/badspeedies.py

From Wikipedia, the free encyclopedia
# A pywikibot script to dump out all speedy deletion requests that still exist. Slightly better than a CSD log as
# it won't trip on recreated articles
import re
import pywikibot
from pywikibot import pagegenerators
import sys

username = sys.argv[ 1 ]
length = 100000

reCSD = re.compile( '^Requesting speedy deletion \(\[\[WP:CSD#(.*)\|CSD .*\]\]\)\. ' )

site = pywikibot.Site()
user = pywikibot.User( site, username )
for contrib in user.contributions( length ):
  title = contrib[ 0 ]
  timestamp = contrib[ 2 ]
  comment = contrib[ 3 ]
  if comment is not None:
    match = reCSD.match( comment )
    if match is not None:
      csd = match.group( 1 )
      print( str( csd ) + ' ' + str( title ) + ' ' + str( timestamp ) )