Stephan Bösch-Plepelits
7 years ago
2 changed files with 55 additions and 3 deletions
@ -0,0 +1,18 @@ |
|||
var httpGet = require('./httpGet') |
|||
|
|||
function wikidataLoad (id, callback) { |
|||
httpGet('https://www.wikidata.org/wiki/Special:EntityData/' + id + '.json', function (err, result) { |
|||
result = JSON.parse(result.body) |
|||
|
|||
if (!result.entities || !result.entities[id]) { |
|||
console.log('invalid result', result) |
|||
return callback(err, null) |
|||
} |
|||
|
|||
callback(null, result.entities[id]) |
|||
}) |
|||
} |
|||
|
|||
module.exports = { |
|||
load: wikidataLoad |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue