Skip to content

Instantly share code, notes, and snippets.

@cupofcodeblog
Created March 17, 2024 15:06
Spotify API - Merging Singles in The Code
...
artist_id = TAYLOR_SWIFT_ARTIST_ID # get_artist_id(access_token, "Taylor Swift")
for album_type in ["album", "single"]:
album_name_to_id_file_path = f"{DIR}1_{album_type}_name_to_id.json"
json_result_album_items = get_albums(access_token, artist_id, album_type)
...
prev_album_name_to_id = from_file_to_json_obj(album_name_to_id_file_path)
album_name_to_id.update(prev_album_name_to_id) # LIFO
write_to_json_file(album_name_to_id_file_path, album_name_to_id)
...
shuffled = list(updated_arr_with_split)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment