JMPerez / spotify-dedup

Remove duplicates from your Spotify Playlists
https://spotify-dedup.com
MIT License
844 stars 74 forks source link

Nothing happens when I press the remove button #15

Closed gabrielcvas closed 8 years ago

gabrielcvas commented 8 years ago

Hello, first of all, thanks for creating this app, it is very useful. I'm trying to remove the duplicated files of my main playlist and nothing happens when I press the button to remove the dupes. This is the playlist: https://open.spotify.com/user/gabrielcvas/playlist/1BGj9OIxEnZG5DPeBdcKnk, can you help me on this issue?

JMPerez commented 8 years ago

@gabrielcvas I will have a look at it

JMPerez commented 8 years ago

There seems to be a problem and one of the requests returns a 400 Bad Request response.

curl 'https://api.spotify.com/v1/users/jmperezperez/playlists/5cZREFLUZxhSHP3Kznw06W/tracks' -X DELETE -H 'Origin: https://jmperezperez.com' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,es;q=0.6' -H 'Authorization: Bearer <edited>' -H 'Content-Type: text/plain;charset=UTF-8' -H 'Accept: */*' -H 'Referer: https://jmperezperez.com/spotify-dedup/' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"tracks":[{"uri":"spotify:track:4dL1HwRWQgWK9timX9PLex","positions":[883]},{"uri":"spotify:track:4JehYebiI9JE8sR8MisGVb","positions":[898]},{"uri":"spotify:track:1cRNEme8Bp7V8eNIAeyiAk","positions":[907]},{"uri":"spotify:track:2Nu0P68oruhup6YcAi8On3","positions":[915]},{"uri":"spotify:track:5Ic7xfvSlj5Jpyi93hExGi","positions":[927]},{"uri":"spotify:track:7pJgjBf82BrUQ3z7HdQvW1","positions":[949]},{"uri":"spotify:track:53b7YqVw2Vc1oRrYeOm7z7","positions":[954]},{"uri":"spotify:track:5h9pB5af60LWJBrG1HCHsU","positions":[961]},{"uri":"spotify:track:0mYPfHvPzoUZJ2puHRyzyf","positions":[998]},{"uri":"spotify:track:0VYQK5I08homNvX8SRS37R","positions":[1005]},{"uri":"spotify:track:70hWOTDBrLrZUfMdQnTI9l","positions":[1016]},{"uri":"spotify:track:2PpruBYCo4H7WOBJ7Q2EwM","positions":[1026]},{"uri":"spotify:track:24YvUQnuPL8gObCfSnAobH","positions":[1029]},{"uri":"spotify:track:2zqv41wBo09liJyULPJccc","positions":[1030]},{"uri":"spotify:track:2hsza71y54ABzmabyNDtM4","positions":[1032]},{"uri":"spotify:track:35WhawODuOs0kaHxwmPA9D","positions":[1038]},{"uri":"spotify:track:089vxHEH64AKLKhokNXEJx","positions":[1045]},{"uri":"spotify:track:0ho4ac5tM9CNcmeIElhadF","positions":[1059]},{"uri":"spotify:track:0ZvUdZndc4SckH6ivQwxdL","positions":[1063]},{"uri":"spotify:track:2Hwm1eMBz0tJx6hlzuz5ud","positions":[1075]},{"uri":"spotify:track:6KM6693N1wVvz6tDviEF4F","positions":[1088]},{"uri":"spotify:track:0eqH0ALoDQevq59YcQ53KE","positions":[1089]},{"uri":"spotify:track:2DvDmy9aCv9TajH0MkHsXa","positions":[1099]},{"uri":"spotify:track:5SmXEPnevlRjBPWBG7oKIi","positions":[1107]},{"uri":"spotify:track:0oXuKhuNkXiZtuoxrdt3Ca","positions":[1118]},{"uri":"spotify:track:0oXuKhuNkXiZtuoxrdt3Ca","positions":[1119]},{"uri":"spotify:track:18eoNBn1L1li2TvPa2DupB","positions":[1121]},{"uri":"spotify:track:1y4eb6hmAvsqlDOl3fx9kk","positions":[1123]},{"uri":"spotify:track:6dKJWmXeYPznzolqo4K6Uq","positions":[1129]},{"uri":"spotify:track:7CFQrZR4WeKEg4vweqp8Gv","positions":[1142]},{"uri":"spotify:track:70VjMtwhm3Q2HBQeJnPfmh","positions":[1162]},{"uri":"spotify:track:0q9Ry3wxCrf0jQvuvs46sz","positions":[1173]},{"uri":"spotify:track:4N8UShrxz5xVJw7yBMGeVj","positions":[1174]},{"uri":"spotify:track:1ccNXmmgYnajJ8ulYYEK9Y","positions":[1218]},{"uri":"spotify:track:4vp2J1l5RD4gMZwGFLfRAu","positions":[1230]},{"uri":"spotify:track:72np30cEzvqzxAUG5mrhyT","positions":[1231]},{"uri":"spotify:track:14iN3o8ptQ8cFVZTEmyQRV","positions":[1241]},{"uri":"spotify:track:005lwxGU1tms6HGELIcUv9","positions":[1242]},{"uri":"spotify:track:6a8GbQIlV8HBUW3c6Uk9PH","positions":[1250]},{"uri":"spotify:track:5aaBnBs9YyfexG7lOH4MZP","positions":[1263]},{"uri":"spotify:track:29viePXNqWUw1cxqzOcuOD","positions":[1264]},{"uri":"spotify:track:6rFKHZniKTOhcYnw5T55Bw","positions":[1271]},{"uri":"spotify:track:5dhQCqONiQji7k4RkhIcjq","positions":[1272]},{"uri":"spotify:track:173PnvZh4grHTf31DPXDbJ","positions":[1279]},{"uri":"spotify:track:5TAf4lnZCZTLlZHNZMLFLi","positions":[1296]},{"uri":"spotify:track:2k1np6GRFvKjgjYfo2g39B","positions":[1302]},{"uri":"spotify:track:7yqU5HODQU91zj8ahUaUX1","positions":[1303]},{"uri":"spotify:track:084rSHN2xIfUrwShDgzk1Q","positions":[1304]},{"uri":"spotify:track:3gkQyMVLWI2A2BELNOv87g","positions":[1307]},{"uri":"spotify:track:41ViNOa85jwxmEiRnGuG5P","positions":[1310]},{"uri":"spotify:track:41ViNOa85jwxmEiRnGuG5P","positions":[1311]},{"uri":"spotify:track:60UZlV9G08xkjcmwsiVteK","positions":[1315]},{"uri":"spotify:track:6J8IwGX3oHi7x9B57vmMMW","positions":[1316]},{"uri":"spotify:track:47BBI51FKFwOMlIiX6m8ya","positions":[1320]},{"uri":"spotify:track:42vuwIlurZqLrHsFYr1pin","positions":[1321]},{"uri":"spotify:track:25QHT4hGAeTUkMXfQkPlJJ","positions":[1329]},{"uri":"spotify:track:6izhPbUU3CeMYvTT74YHnb","positions":[1332]},{"uri":"spotify:track:4gJxLdiZXkKiSbvpFHNu8n","positions":[1339]},{"uri":"spotify:track:05pKAafT85jeeNhZ6kq7HT","positions":[1345]},{"uri":"spotify:track:5xuu2VJq5QaMO7gLHiI8PZ","positions":[1364]},{"uri":"spotify:track:37fGGrNQgxZ3qGOvAebg9i","positions":[1384]},{"uri":"spotify:track:4sUoWHVnJl8z3t4zdqf6xB","positions":[1385]},{"uri":"spotify:track:2ze7s5CrESggiWA3RpDYIy","positions":[1386]},{"uri":"spotify:track:003qa9jZ2byfApC0hBnr0G","positions":[1407]},{"uri":"spotify:track:2jHujamO9UuZv8im9eLdOB","positions":[1408]},{"uri":"spotify:track:3S0OXQeoh0w6AY8WQVckRW","positions":[1411]},{"uri":"spotify:track:57URzGoYgSj0AiXclvqD6y","positions":[1412]},{"uri":"spotify:track:5UqqOfFa9DYXALpCCF8VwB","positions":[1414]},{"uri":"spotify:track:0A8HK5hV5SgywiKKrBPKDU","positions":[1423]},{"uri":"spotify:track:26NX1wPt1TRCH536yocd6i","positions":[1432]},{"uri":"spotify:track:2hdy9Wt9qp7M7d0U3ossu2","positions":[1437]},{"uri":"spotify:track:360UM2DaiHZPRu0EsrOvMp","positions":[1439]},{"uri":"spotify:track:1EQgbMBc304Ss86dXBulJA","positions":[1443]},{"uri":"spotify:track:3wvg3Jpee5NzpSBZhBqFdE","positions":[1444]},{"uri":"spotify:track:4rIEkt9wgcmoIJtiRcvtNX","positions":[1447]},{"uri":"spotify:track:3zSCNTXI7Ed0PiidZVmzIe","positions":[1449]},{"uri":"spotify:track:5vE7vbd9Q2Rgw4JqtkD3pe","positions":[1451]},{"uri":"spotify:track:16sbugRbf9xEKlekuQ7Whm","positions":[1456]},{"uri":"spotify:track:7iL6o9tox1zgHpKUfh9vuC","positions":[1463]},{"uri":"spotify:track:6Kh4FkETk9i3EUVTerZEuY","positions":[1484]},{"uri":"spotify:track:00IEQOqwlB0hngGY9zD3Bw","positions":[1488]},{"uri":"spotify:track:2julHzta3pq6E1ugxyvsbj","positions":[1525]},{"uri":"spotify:track:0U0mMRtYifdTaRltbemBee","positions":[1526]},{"uri":"spotify:track:0OaunKfsxkgBvPv68jBbmm","positions":[1532]},{"uri":"spotify:track:0RUGuh2uSNFJpGMSsD1F5C","positions":[1534]},{"uri":"spotify:track:2AW37v0bDyuOzGP3XnmFuA","positions":[1539]},{"uri":"spotify:track:4TmGtGkkmaoXRCvpOwDJoO","positions":[1542]},{"uri":"spotify:track:2fOxxLz9JVe53itq6pfBak","positions":[1544]},{"uri":"spotify:track:5TgD3Wh5ZUZnUU4tmVvJbx","positions":[1551]},{"uri":"spotify:track:7g7tyb8zM9UeKsdvosW9W3","positions":[1557]},{"uri":"spotify:track:1Pje5DSZWSD1JLEZVx7Fma","positions":[1562]},{"uri":"spotify:track:43btz2xjMKpcmjkuRsvxyg","positions":[1563]},{"uri":"spotify:track:59wpu37k02o2UGZIPpcSPd","positions":[1567]},{"uri":"spotify:track:6jHKJ5sennAgsNI6m15VO0","positions":[1576]},{"uri":"spotify:track:0vYMzeTmfbnrAhGPRcJqVP","positions":[1580]},{"uri":"spotify:track:1sgfjgLRCqSfndpofU8T2C","positions":[1583]},{"uri":"spotify:track:79ek2oolIYyGUO4aVK5IY2","positions":[1585]},{"uri":"spotify:track:7rr5DQM980mOF1UtIC4q6v","positions":[1594]},{"uri":"spotify:track:4pmc2AxSEq6g7hPVlJCPyP","positions":[1605]},{"uri":"spotify:track:513Pk2WNJaTGMjqD4AuQ8T","positions":[1616]}]}' --compressed

I will try to contact the team in Spotify to see if they can get it fixed.

nickolu commented 8 years ago

Here are more details about the error. I'm seeing it only when trying to dedupe certain playlists. My biggest playlist is the major culprit right now. It has over 4,000 tracks, and I have discovered that many of the tracks have multiple duplicates (in some cases 3+ copies of the same track).

Here are the details of the error from my console:

1b078df0.main.js:1 Uncaught (in promise) XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, responseURL: "https://api.spotify.com/v1/users/129187374/playlists/4pbgvE1gV1HbsGtge7lqYk/tracks"…}onabort: nullonerror: nullonload: nullonloadend: nullonloadstart: nullonprogress: nullonreadystatechange: ()arguments: (...)caller: (...)length: 0name: ""prototype: Objectproto: ()ontimeout: nullreadyState: 4response: "{↵ "error": {↵ "status": 400,↵ "message": "Could not remove tracks, please check parameters."↵ }↵}"responseText: "{↵ "error": {↵ "status": 400,↵ "message": "Could not remove tracks, please check parameters."↵ }↵}"responseType: ""responseURL: "https://api.spotify.com/v1/users/129187374/playlists/4pbgvE1gV1HbsGtge7lqYk/tracks"responseXML: nullstatus: 400statusText: "Bad Request"timeout: 0upload: XMLHttpRequestUploadonabort: nullonerror: nullonload: nullonloadend: nullonloadstart: nullonprogress: nullontimeout: nullproto: XMLHttpRequestEventTargetwithCredentials: falseproto: XMLHttpRequestEventTarget(anonymous function) @ 1b078df0.main.js:1

JMPerez commented 8 years ago

@nickolusroy Yes, it looks like the same error. I will try creating a small playlist adding the same tracks more than twice.

JMPerez commented 8 years ago

@nickolusroy Having a track many times doesn't cause the issue. I have managed to simplify the case that produces the error and added it to the issue I opened in the Web API GitHub repo.

nickolu commented 8 years ago

Thanks for the update! If I can help reproduce or anything else let me know.

serjoscha87 commented 8 years ago

Don't know sure if this is the same issue (but I think so): Your webapp was able to delete the dupes of 3 of my playlist but failed on this one: https://open.spotify.com/user/shadowgrind1337/playlist/2Jr8MO20jNhx9JWNDaD0y0 with the (console) error "error:{status: 400, message: "Could not remove tracks, please check parameters."}"

JMPerez commented 8 years ago

@serjoscha87 I have managed to reproduce it. It returns 400 when trying to remove this set of tracks:

screen shot 2016-06-07 at 21 32 00

I'm going to try to find out what's happening.

serjoscha87 commented 8 years ago

Superb! Thank you!

JMPerez commented 8 years ago

The request fails due to, at least, the track spotify:track:6oO7WMjD6kEvCITLbVj0mu in position 692. That is Hypnotize by System of a Down. This is similar to the issue reported to the Web API team in https://github.com/spotify/web-api/issues/206, so I will add some info there too.

Jonher937 commented 8 years ago

I have the same issue, I don't know if it's of any help, but these two playlists won't do anything when I try to remove duplicates (successfully ran on 10 other playlist, thanks for a great tool!) These won't work: spotify:user:jonher937:playlist:7GQw5uzItsVDkkJbSH21LJ and spotify:user:jonher937:playlist:3klM6KzYwNJs1Z9GZipLr9

JMPerez commented 8 years ago

It looks like we know where the problem lies. Instead of using the track id returned from the list of playlist's tracks, we should return the "linked_from" track id if it exists. So, instead of removing spotify:track:6oO7WMjD6kEvCITLbVj0mu we should request to remove spotify:track: 06Y2PqTEeX4u8nlZeX7UIc.