Rewrite getPhotos function in flickerripper

It has been done to avoid using duplicate codes.
See https://scrutinizer-ci.com/g/wikimedia/pywikibot-core/indices/373851/duplications/23725239

Change-Id: I4f000ed09d688f375b3681536d3ca214c2457e60
Merge "Rewrite getPhotos function in flickerripper"