手册:Pywikibot/harvest template.py

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/harvest template.py and the translation is 100% complete.

harvest_template.py是一个从维基百科模板中获取信息来批量添加声称的脚本.

概念

维基百科上的模板,尤其是信息框包含许多有用的信息,可用于将声称添加到维基数据的数据项

语法

机器人需要一个生成器,模板的名称和模板中的字段以及存储它的属性。命令如下所示:

$ python pwb.py harvest_template <some generator> \
    -template:<name of template> \
    <field A> P1 <field B> P3

这是一个具有实际值的实际命令:

$ python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \
        -template:"Infobox person" image P18 birth_place P19

机器人将自动确定是要解析数据项属性还是使用字符串属性。

根据您的配置,您可能需要指定从中提取模板的站点。你可以使用-lang:XX -family:wikipedia,其中XX是你想要使用的wiki的语言代码。