There is an out of bound exception when iterating over info['entries'][j] in get_playlist_info() The lenght of info['entries'] has to be taken into account in the loop boundaries