Move wikidata querying into a class

Also output JSON of missing page ids