Open main menu

I developed a bot which can organizing language links in locale wiki and Wikidata

  • adding new items if they don't exist in Wikidata for:
    • none-interwiki pages
    • with-interwiki pages which none of language links doesn't have item in Wikidata
  • updateing items in wikidata
  • adding labels according to language's interwiki
Local wiki
  • removing old interwikis which exist in Wikidata from Local wiki pages
  • adding {{interwiki conflict}} (Q6099744) in Local wiki to pages which their interwikis has conflict

This bot uses pywikipedia library + Wikidata library (below) which I updated and modified Wikidata library to have best result.

Bot Flag neededEdit

For running this bot you should have flag in local wiki and Wikidata

  • local wiki: (removing existed old_interwikis in Wikidata from pages) -remove argument
  • Wikidata: (creating or updating items and updating labels)

Running BotEdit

This Bot only runs on linux or Toolserver computers! and for windows or mac it needs more changes.

For running this bot you should do these steps

  • ‌Be sure that you are using final version of pywikipedia library. for ToolServer account go to pywikipedia folder and type : svn update
  • copy wikidata library (below) to your pywikipedia folder
  • set your username and password in passfile
  • set your pywikipedia address in config
  • set your pywikipedia address in
  • set your pywikipedia address in line 46 of
  • at your set your bot like below (BotName= your bot username and xx= your wiki prefix for example en for English )
family = 'wikipedia'
mylang = 'xx'
password_file= 'passfile'
usernames['wikipedia']['xx'] = u'BotName'
usernames['wikidata']['wikidata'] = u'BotName'

This bot accepts pywikipedia standard arguments like (new, start, page, cat) also for new categories it accepts (newcat)

Updating or making items for page [[XXXX]]
python -page:XXXX
Updating or making items which the page's name starts with AB and removing existing interwikis from local wiki
python -start:AB -remove
Updating or making items for 100 new cats and removing existing interwikis from local wiki
python -newcat -remove

Reporting errorsEdit

this bot reports two errors

  1. Item conflicts in file interwiki_conflicts.txt
  2. API errors in file interwiki_import_errors.txt
  3. Save list of empty items which is made after merging in the file zzinterwiki_import_merged_need_deleted.txt
  • Important Note: Because of changing the API URL you should do this edit in file!


You can download these codes from here




Problem with running the BotEdit

  1. Be sure that you done #Running Bot steps