@@ -0,0 +1,923 @@
+# -*- coding: utf-8 -*-%0Aimport argparse%0Aimport csv%0Aimport os%0A%0Aos.environ%5B'PYWIKIBOT_DIR'%5D = os.path.dirname(os.path.realpath(__file__))%0Aimport pywikibot%0A%0A%0Asite = pywikibot.Site()%0Asite.login()%0Adatasite = site.data_repository()%0A%0A%0Adef addSitelinks(title, site, targettitle):%0A    print(title)%0A%0A    if title%5B0%5D == 'Q':%0A        myitem = pywikibot.ItemPage(datasite, title)%0A    else:%0A        print('%5Ct Not Item page')%0A        return%0A%0A    data = %7B%0A        'site': site,%0A        'title': targettitle%0A    %7D%0A    print('%5Ct', data)%0A    myitem.setSitelink(data, summary='%E8%87%AA%E5%8B%95%E8%A8%AD%E5%AE%9Awikidata%E9%80%A3%E7%B5%90')%0A%0A%0Adef main(filename):%0A    with open(filename) as csvfile:%0A        reader = csv.reader(csvfile)%0A        for row in reader:%0A            addSitelinks(row%5B0%5D, 'wikidatawiki', row%5B1%5D)%0A%0A%0Aif __name__ == %22__main__%22:%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument('filename', nargs='?')%0A    args = parser.parse_args()%0A    main(args.filename)%0A

Create mass-add-sitelinks