# coding: utf-8 require 'sunflower' s = Sunflower.new 'commons' cat = s.make_list 'category_recursive', 'Category:License tags' cat = cat.select{|c| c.start_with? 'Template:' }.reject{|c| c.include? '/' } puts cat.length tpl = s.API_continued 'rawcontinue=1&action=query&list=embeddedin&eititle=Template%3ALicense_template_tag&einamespace=10&eilimit=max', 'embeddedin', 'eicontinue' tpl = tpl['query']['embeddedin'].map{|h| h['title']} puts tpl.length to_verify = (cat-tpl) bad = to_verify.select do |t| result = s.API( action: 'parse', prop: 'templates', title: 'File:UploadWizard license verification.png', text: "{{#{t}}}" ) result['parse']['templates'].none?{|r| r['*'] == 'Template:License template tag' } end puts bad puts bad.length