Fix port of imagetransfer
Fix port of imagetransfer

Using the script with -interwiki or a page other than an image
resulted in exceptions due to incorrect usage of core library.

Bug: T86627
Change-Id: I941b9d72467b98378f2ef66c52b8d22261a3e5d9

hasteur/g13bot_tools_new,TridevGuha/pywikibot-core,npdoty/pywikibot,happy5214/pywikibot-core,xZise/pywikibot-core,Darkdadaah/pywikibot-core,trishnaguha/pywikibot-core,h4ck3rm1k3/pywikibot-core,wikimedia/pywikibot-core,wikimedia/pywikibot-core,happy5214/pywikibot-core,jayvdb/pywikibot-core,PersianWikipedia/pywikibot-core,hasteur/g13bot_tools_new,darthbhyrava/pywikibot-local,npdoty/pywikibot,valhallasw/pywikibot-core,jayvdb/pywikibot-core,Darkdadaah/pywikibot-core,icyflame/batman,magul/pywikibot-core,hasteur/g13bot_tools_new,magul/pywikibot-core,smalyshev/pywikibot-core,VcamX/pywikibot-core,h4ck3rm1k3/pywikibot-core,emijrp/pywikibot-core