code partitioned from get_images to collect urls only