Fix image scrape error & simplify code

Solved KeyError issue with a while loop hack. Added save_img, get_json functions. Made existing functions more general.