我正在寻找一种方法来找出具有特定标签和描述的项目是否已经存在于 Wikidata 上。此任务应由 Pywikibot 执行。如果它已经存在,我不希望我的 Bot 创建一个新项目。到目前为止,我的代码如下所示:
...
def check_item_existence(self):
transcript_file = self.transcript_file
with open(transcript_file) as csvfile:
transcript_dict = csv.DictReader(csvfile, delimiter="\t")
for row in transcript_dict:
site = pywikibot.Site("en", "TillsWiki")
existing_item = pywikibot.ItemPage(site, row['Name'])
title = existing_item.title()