A better way of working with the wikidata
npm i --save iwf
You can easily request an item from wikidata and list all the labels.
import {requestItem} from 'iwf';
const item = requestItem('Q42');
console.log(item.labels);
Or create a new item and upload it to wikidata.
import { Item, getToken, upload, Label, Statement, WikibaseItemSnak } from 'iwf';
const item = Item.fromNothing();
item.labels.push(Label.fromString('en', 'new planet '));
item.statements.push(Statement.fromSnak(WikibaseItemSnak.fromID('P31', 'Q634')));
const token = await getToken('your wikidata username', 'your wikidata password');
upload(item, {
summary: 'test update',
authToken: token
});
To see all the functionality, extra documentation, and examples, visit the documentation
You are already helping by using this library, but if you want to do more, there are a few things you can do:
There is a FUTURE.md file that contains ideas for future development. If you want to help, you can look there for ideas.
Generated using TypeDoc