Jump to content

User:Trialpears/sandbox/5

From Wikipedia, the free encyclopedia

> / Name Last Modified

Selection deleted import pywikibot import re import time import os import json from pywikibot import pagegenerators site = pywikibot.Site('en', 'wikipedia') discussions = {} i = 0

for page in pagegenerators.SearchPageGenerator('intitle:"Templates for discussion/Log""', namespaces = [4]):

   text = page.text
   pagename = page.title()
   i += 1
   sections = re.findall(r"[^=]====[^=]+====[^=].*?(?=====|$)", text, flags=re.S)
   for section in sections:
           if not re.search("<\s*div",section):
               continue
           try:
               result = re.search(r"(The result of the (debate|discussion) was|The template was)(\s*\s*)?(\s*to\s*)?:?\s*({{[^{}]*({{[^{}]*({{{[^{}]*}}})[^{}]*}})?[^{}]*({{[^{}]*}}|{{{[^{}]*}}})?[^{}]*}})?\s*()?([a-zA-Z ]+)",section).group(8)
           except:
               print("Can't find result at " + pagename + "")
               continue
           try:
               name = re.search(r"====[\s\[]*([^=]+?)[\s\]]*====",section).group(1)
           except:
               print("Can't find section name at " + pagename )
               continue
           templates=pywikibot.textlib.extract_templates_and_params(section,remove_disabled_parts="yes",strip = "yes")
           if result in ["Relist","relist"]:
               continue
           for template, args in templates:
               if template in ["Tfdlinks", "Tfd links", "Template links"]:
                   topic = args.get("1")
                   if discussions.get(topic):
                       discussions[topic] += [(pagename+"#"+name,result)]
                   else:
                       discussions[topic] = [(pagename+"#"+name,result)]
       
   if i % 100 == 0:
       print(i)

with open('tfd_discussions.txt', 'w+') as file:

   file.write(json.dumps(discussions)) 

100 200 300 400 500 600 Can't find result at Wikipedia:Templates for discussion/Log/2022 January 14 700 Can't find result at Wikipedia:Templates for discussion/Log/2015 January 18 800 Can't find result at Wikipedia:Templates for discussion/Log/2014 February 18 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 Can't find result at Wikipedia:Templates for discussion/Log/2014 February 10 2000 2100 Can't find result at Wikipedia:Templates for discussion/Log/2021 April 1 Can't find result at Wikipedia:Templates for discussion/Log/2021 April 1 2200 2300 Can't find result at Wikipedia:Templates for discussion/Log/2018 November 3 Can't find result at Wikipedia:Templates for deletion/Log/2008 December 12 2400 2500 2600 2700 2800 2900 3000 3100 3200 Can't find result at Wikipedia:Templates for deletion/Log/2009 February 6 3300 Can't find result at Wikipedia:Templates for deletion/Log/2008 February 21 Can't find result at Wikipedia:Templates for deletion/Log/2008 February 21 3400 3500 Can't find result at Wikipedia:Templates for discussion/Log/2010 April 2 3600 3700 3800 3900 Can't find result at Wikipedia:Templates for deletion/Log/2008 October 8 Can't find result at Wikipedia:Templates for discussion/Log/2011 August 10 Can't find result at Wikipedia:Templates for deletion/Log/2006 September 18 4000 Can't find result at Wikipedia:Templates for discussion/Log/2013 May 12 4100 4200 4300 Can't find result at Wikipedia:Templates for deletion/Log/2006 April 3 Can't find result at Wikipedia:Templates for discussion/Log/2011 December 13 4400 Can't find result at Wikipedia:Templates for deletion/Log/2008 February 12 4500 4600 4700 Can't find result at Wikipedia:Templates for discussion/Log/2013 January 23 Can't find result at Wikipedia:Templates for deletion/Log/2008 October 12 4800 4900 5000 Can't find result at Wikipedia:Templates for discussion/Log/2012 January 10 5100 Can't find result at Wikipedia:Templates for deletion/Log/2007 May 12 Can't find result at Wikipedia:Templates for deletion/Log/2006 September 25 5200 Can't find result at Wikipedia:Templates for deletion/Log/2008 February 14 Can't find result at Wikipedia:Templates for deletion/Log/2006 July 30 5300 Can't find result at Wikipedia:Templates for discussion/Log/2012 January 11 5400 5500 5600 Can't find result at Wikipedia:Templates for deletion/Log/2009 February 15 Can't find result at Wikipedia:Templates for deletion/Log/2009 May 18 5700 Can't find result at Wikipedia:Templates for deletion/Log/2008 April 23 5800 Can't find result at Wikipedia:Templates for discussion/Log/2011 December 8 Can't find result at Wikipedia:Templates for deletion/Log/2007 November 16 5900 Can't find result at Wikipedia:Templates for discussion/Log/2011 December 16 6000 Can't find result at Wikipedia:Templates for deletion/Log/2006 September 27 Can't find result at Wikipedia:Templates for discussion/Log/2011 December 14 Can't find result at Wikipedia:Templates for deletion/Log/2006 February 21 Can't find result at Wikipedia:Templates for deletion/Log/2006 July 24 6100 6200 Can't find result at Wikipedia:Templates for deletion/Log/2006 August 17 Can't find result at Wikipedia:Templates for discussion/Log/Not deleted/June 2005 Can't find result at Wikipedia:Templates for discussion/Log/2010 December 15 6300 Can't find result at Wikipedia:Templates for deletion/Log/2007 March 7 Can't find result at Wikipedia:Templates for discussion/Log/2012 January 9 6400 Can't find result at Wikipedia:Templates for deletion/Log/2007 April 13 Can't find result at Wikipedia:Templates for discussion/Log/2011 December 18 Can't find result at Wikipedia:Templates for discussion/Log/Deleted/July 2005 6500 Can't find result at Wikipedia:Templates for deletion/Log/2006 January 9 Can't find result at Wikipedia:Templates for discussion/Log/Deleted/May 2005 Can't find result at Wikipedia:Templates for discussion/Log/Deleted/May 2005 Can't find result at Wikipedia:Templates for discussion/Log/Not deleted/December 2005 Can't find result at Wikipedia:Templates for deletion/Log/2006 May 11 Can't find result at Wikipedia:Templates for deletion/Log/2008 March 26 6600