Manual:Pywikibot/harvest template.py
Pywikibot logo |
Pywikibot scripts |
---|
|
v · d · e |
harvest_template.py is a script to mass add Wikidata claims based on information harvested from Wikipedia templates.
Concept
[edit ]Templates on Wikipedia, especially infoboxes, contain a lot of useful information that can be used to add claims to Wikidata items.
Syntax
[edit ]The bot expects a generator, the name of the template and pairs the field in the template and the property to store this in. The command will look like:
$ pythonpwb.pyharvest_template<somegenerator>\ -template:<nameoftemplate>\ <fieldA>P1<fieldB>P3
This is an actual command with real values:
$ pythonpwb.pyharvest_template-lang:en-family:wikipedia-namespace:0\ -template:"Infobox person"imageP18birth_placeP19
The bot will automatically figure out whether to parse an item property or to use a string property.
Depending on your configuration, you may need to specify which site to pull the template from. You can do this with -lang:XX -family:wikipedia
where XX is the language code of the wiki you want to use.