def get_query_id(query_results, query_type='track'):
    """
    get id(s) for query results. if query type is set to track also returns
    preview url.
    :param query_results: json object
    :param query_type: str
    :return: id_list
    """
    id_list = list()
    for item in query_results:

        album_name = item['album']['name']
        album_image = item['album']['images'][2]['url']
        artist_name = item['album']['artists'][0]['name']
        song_name = item["name"]
        item_id = item["id"]

        if query_type == query_type:
            preview = item["preview_url"]
            id_list.append((
                album_name, album_image, artist_name,
                song_name, item_id, preview
            ))
        else:
            id_list.append((
                album_name, album_image, artist_name,
                song_name, item_id
            ))

    return id_list