get_videoinfo refactored to smaller functions