Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
2.67k stars 109 forks source link

Error importing long tracknames #345

Closed yaakovfeldman closed 3 months ago

yaakovfeldman commented 4 months ago

Thanks for creating this tool, it is great!

I am importing my StreamingHistory_music_x.json files from the account information privacy download and it is stuck on 'Importing 10792 of 11462'. I have retried a few times and it always gets stuck on the same track. The logs show [error] AxiosError: Request failed with status code 400.

The request url in the logs is /search?q=track:Der%20fur%20die%20Sunden%20der%20Welt%20gemarterte%20und%20sterbende%20Jesus%2C%20TWV%205%3A1%2C%20%22Brockes%20Passion%22%3A%20Recitative%3A%20Drauf%20sagten%20sie%20(Evangelist)%20-%20Accompagnato%3A%20Ihr%20werdet%20all'%20(Jesus)%20-%20Chorus%3A%20Wir%20wollen%20%E2%80%A6%20-%20Accompagnato%3A%20Es%20ist%20%E2%80%A6%20(Jesus)+artist:Georg%20Philipp%20Telemann&type=track&limit=10

I wrote a few lines of JS to try this request myself (redacted my token in the below):

fetch(
    "https://api.spotify.com/v1/search?q=track:Der%20fur%20die%20Sunden%20der%20Welt%20gemarterte%20und%20sterbende%20Jesus%2C%20TWV%205%3A1%2C%20%22Brockes%20Passion%22%3A%20Recitative%3A%20Drauf%20sagten%20sie%20(Evangelist)%20-%20Accompagnato%3A%20Ihr%20werdet%20all'%20(Jesus)%20-%20Chorus%3A%20Wir%20wollen%20%E2%80%A6%20-%20Accompagnato%3A%20Es%20ist%20%E2%80%A6%20(Jesus)+artist:Georg%20Philipp%20Telemann&type=track&limit=10",
    {
        headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer redacted'
        }
    }
)

It does indeed get a 400. However if I delete some of the middle of it to shorten it a bit (e.g. removing the artist part of the query or deleting some of the track name) then it gives a 200 and returns a list of tracks.

Could this be an undocumented limit in the request length?

Also (separate question), I have requested my extended streaming history from spotify as well but have not yet received it. When I import it will everything from the first import be duplicated?

Yooooomi commented 3 months ago

Hey, this should be fixed by now right? Are you still having the issue?

yaakovfeldman commented 3 months ago

I haven’t tried again with that data file but I subsequently received and imported my full listening history with no issues (presumably including the same long track name again) so I assume it can be closed :) Thank you!