import pywikibot
import PPVutility
site = pywikibot.Site("en","wikipedia")
from PPVutility import hasresults, pageswithresults, results
ppvs = pywikibot.Category(site, "WWE_pay-per-view_events")
ppvarticles = ppvs.articles(recurse = True, total = 100000)
plist = list(ppvarticles)
withresults = pageswithresults(plist)
p = results(withresults[0].get())
import collections
p2 = PPVutility.stripspaces(results(withresults[0].get()))
times = PPVutility.striptimes(p2)
times
['05:00', '12:13', '11:56', '21:40', '05:50', '10:15', '19:46', '08:52']
"," + ",".join(times) + "\n"
',05:00,12:13,11:56,21:40,05:50,10:15,19:46,08:52\n'
withresults[0].title() + "," +",".join(times)
'WWE Breaking Point,05:00,12:13,11:56,21:40,05:50,10:15,19:46,08:52'
PPVutility.striptimes(PPVutility.resultsfrompage(withresults[0]))
['05:00', '12:13', '11:56', '21:40', '05:50', '10:15', '19:46', '08:52']
PPVutility.striptimesfrompage(withresults[0])
['05:00', '12:13', '11:56', '21:40', '05:50', '10:15', '19:46', '08:52']
f = open("times.csv","w")
for page in set(withresults):
        times = PPVutility.striptimesfrompage(page)        
        f.write(page.title() + ";;" + ";;".join(times) + "\n")    
f.close()
f = open("matches.csv","w")
for page in set(withresults):
        matches = PPVutility.stripmatchesfrompage(page)
        for n, match in enumerate(matches):
            f.write(page.title() + "\t" + str(n) + "\t" + match + "\n")
f.close()
len(withresults)
713
s = set(withresults)
len(s)
362
len(plist)
868
len(set(plist))
507