import pywikibot

from pywikibot import i18n, pagegenerators, Bot

from scripts.image import ImageRobot as ImageBot
 
old_images = ['Berkas:Tjetjep-Muchtar-Solehbptcianjur.jpg']

for old_image in old_images:
    new_image = 'Berkas:Tjetjep-Muchtar-Solehbptcianjur.jpg'
    options = {
        'always': True,
        'loose': True
    }

    site = pywikibot.Site('id', 'wikipedia')


    old_imagepage = pywikibot.FilePage(site, old_image)
    gen = pagegenerators.FileLinksGenerator(old_imagepage)
    preloadingGen = pagegenerators.PreloadingGenerator(gen)
    bot = ImageRobot(preloadingGen, old_image, new_image,
                     site=site, **options)
    bot.run()
Retrieving 1 pages from wikipedia:id.
No changes were necessary in [[id:Tjetjep Muchtar Soleh]]
 
1
2
3