import pywikibot
from pywikibot import pagegenerators

useCategory='Categorie:Voetballer naar nationaliteit'
useCreator='Gonta-Kun'
useCatFind='voetbal'
useSite='nl'
useTarget='Gebruiker:Edoderoo/Japanse voetbalsters'

def getCategory(page,text2find=None):
  catfound = None
  for c in page.categories():
    if not(text2find==None):
      if ((c.title().upper().find(text2find.upper())) >= 0):
        catfound = c.title()[10:]
        break
    else: 
      catfound=c.title()[10:] 
      break
    
  return catfound

wikitext='{| class="wikitable"\n|-\n!counter!!consec!!lemma!!aanmaker!!laatste-edit!!categorie!!aanmaakdatum!!wikidata\n|-\n'
site=pywikibot.Site(useSite)
cat = pywikibot.Category(site,useCategory)
gen = pagegenerators.CategorizedPageGenerator(cat,12)
doublefound=i=j=0
lijstje=double=[]
for page in gen:
  i+=1
  orev=page.oldest_revision
  aanmaker=orev.user
  aanmaakdatum=orev.timestamp
  #aanmaker=page.getCreator()[0]
  #aanmaakdatum=page.getCreator()[1][:10]
  if (aanmaker==useCreator):
    if not(page.title() in lijstje):
      lijstje.append(page.title())
      catfound = getCategory(page,text2find=useCatFind)
      j+=1
      oneline =f'|-\n|{i}||{j}||[[{page.title()}|{page.title()}]]||{aanmaker}||{page.latest_revision.user}||{catfound}||{aanmaakdatum}||[[d:{page.data_item().title()}]]' 
      print(oneline)
      wikitext = wikitext + oneline + '\n'
    else: 
      doublefound += 1    
      double.append(page.title())
wikitext = wikitext + '|}\n\n'
for x in double:
  wikitext = wikitext + '*%s\n' % x
      
print('\aKlaar: %s found double' % doublefound) 
pywikibot.Page(site,useTarget).put(wikitext,summary=u'%s artikelen gevonden, door %s begonnen' % (j,useCreator))     
import pywikibot

site=pywikibot.Site('nl','wikipedia')
page=pywikibot.Page(site,'Kamerik')
print(page.watch(False))
#print(type(page.latest_revision))
#for ill in page.langlinks():
#    print(f'{ill.site}-{ill.title}')
#print(type(ill))
True