Task: TestLogan123

n8n workflow JSON:
{"nodes":[{"name":"On clicking 'execute'","type":"n8n-nodes-base.manualTrigger","position":[460,510],"parameters":{},"typeVersion":1},{"name":"Merge","type":"n8n-nodes-base.merge","position":[1140,400],"parameters":{"mode":"removeKeyMatches","propertyName1":"uri","propertyName2":"uri"},"typeVersion":1,"alwaysOutputData":false},{"name":"Merge1","type":"n8n-nodes-base.merge","position":[1136,602],"parameters":{"mode":"removeKeyMatches","propertyName1":"uri","propertyName2":"uri"},"typeVersion":1,"alwaysOutputData":false},{"name":"Extract URIs Sync","type":"n8n-nodes-base.function","position":[940,600],"parameters":{"functionCode":"if (items.length == 1 && Object.keys(items[0].json).length == 0) {\n  return [];\n}\nreturn items.map(item => ({json: {uri: item.json.track.uri}}));\n"},"typeVersion":1,"alwaysOutputData":true},{"name":"Spotify Get Tracks Mirror","type":"n8n-nodes-base.spotify","maxTries":5,"position":[736,602],"parameters":{"resource":"playlist","operation":"getTracks","returnAll":true},"credentials":{"spotifyOAuth2Api":"SpotifyAPI"},"retryOnFail":true,"typeVersion":1,"alwaysOutputData":true,"waitBetweenTries":5000},{"name":"Spotify Add Item Mirror","type":"n8n-nodes-base.spotify","maxTries":5,"position":[1330,400],"parameters":{"trackID":"={{$json.uri}}","resource":"playlist"},"retryOnFail":true,"typeVersion":1,"waitBetweenTries":5000},{"name":"Spotify Remove Item Mirror","type":"n8n-nodes-base.spotify","maxTries":5,"position":[1340,600],"parameters":{"trackID":"={{$json.uri}}","resource":"playlist","operation":"delete"},"retryOnFail":true,"typeVersion":1,"waitBetweenTries":5000},{"name":"Spotify Get Saved Tracks","type":"n8n-nodes-base.spotify","maxTries":5,"position":[740,400],"parameters":{"resource":"library","returnAll":true},"retryOnFail":true,"typeVersion":1,"alwaysOutputData":true,"waitBetweenTries":5000},{"name":"Get URI - Filter liked albums","type":"n8n-nodes-base.function","position":[950,400],"parameters":{"functionCode":"let albums = items.map(item => ({track : item.json.track.uri,\n                                 album: item.json.track.album.uri,\n                                 type: item.json.track.album.album_type,\n                                 tracks: item.json.track.album.total_tracks}))\n\nlet album_id = albums.filter(item => (item.type === 'album')).map(item => item.album + \":\" + item.tracks)\n\nvar count = {};\nalbum_id.forEach(function(i) { count[i] = (count[i]||0) + 1;});\n\nlet duplicated_albums = Object.keys(count).map( function(key,index) { return parseInt(key.split(':')[3]) == count[key] ? key.split(':').slice(0,3).join(':')  : false} )\n                                          .filter(item => item);\n\nlet only_tracks = albums.filter(item => !duplicated_albums.includes(item.album))\n                        .map(item => ({json: {uri: item.track}}))\nreturn only_tracks\n"},"typeVersion":1}],"connections":{"Merge":{"main":[[{"node":"Spotify Add Item Mirror","type":"main","index":0}]]},"Merge1":{"main":[[{"node":"Spotify Remove Item Mirror","type":"main","index":0}]]},"Extract URIs Sync":{"main":[[{"node":"Merge","type":"main","index":1},{"node":"Merge1","type":"main","index":0}]]},"On clicking 'execute'":{"main":[[{"node":"Spotify Get Saved Tracks","type":"main","index":0},{"node":"Spotify Get Tracks Mirror","type":"main","index":0}]]},"Spotify Get Saved Tracks":{"main":[[{"node":"Get URI - Filter liked albums","type":"main","index":0}]]},"Spotify Get Tracks Mirror":{"main":[[{"node":"Extract URIs Sync","type":"main","index":0}]]},"Get URI - Filter liked albums":{"main":[[{"node":"Merge","type":"main","index":0},{"node":"Merge1","type":"main","index":1}]]}}}