Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-1216

Exporting playlists to Spotify fails with some playlists

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • None
    • API, import tools
    • None

      Have been getting errors exporting playlists to Spotify [and playing it on Listenbrainz], once the account is successfully connected. By my own account and by other people (so it has been replicated).

      Thess playlists always fail:
      https://listenbrainz.org/playlist/6b8b5583-46d3-4a4c-8eec-d4e90ed1ed27/
      https://listenbrainz.org/playlist/7bbc9a5d-dbf1-44bd-9cc8-97b505ef4a53/
      https://listenbrainz.org/playlist/f51de88b-6c00-4e10-b8dd-9b07ea5d899e/
      https://listenbrainz.org/playlist/7bbc9a5d-dbf1-44bd-9cc8-97b505ef4a53/

      These ones work fine:
      https://listenbrainz.org/playlist/d726e8ea-72e3-4652-98eb-f0765b33d5a0/
      https://listenbrainz.org/playlist/8da62d37-adc6-4b71-9e96-b81cc1b2d951/
      https://listenbrainz.org/playlist/a79c5bc0-7f31-4648-88f1-ffa00e1e4e13/
      https://listenbrainz.org/playlist/b71f8d72-2a80-46a6-9214-af22898ad405/
      https://listenbrainz.org/playlist/7515a9c2-06ad-4588-bd89-b72ec55b4b66/
      https://listenbrainz.org/playlist/da6c690b-c533-4f62-bffb-671e9d81fd43/
      https://listenbrainz.org/playlist/8abf5d92-f4c2-41d1-9378-6380b5703616/

      I have found adding a single track to this playlist:
      https://listenbrainz.org/playlist/59d3be13-46c2-4378-8cc1-f6d8a210ee17/

      i.e. going from 116 tracks to 117, makes spotify to fail.
      You have such example here:
      https://listenbrainz.org/playlist/546c371a-2274-4cce-8e87-abdb67860b28/#

      Although one of the working playlists at top has 133 tracks and works fine
      https://listenbrainz.org/playlist/7515a9c2-06ad-4588-bd89-b72ec55b4b66/#

      This is the error in all cases:

      The error at console:
      POSThttps://api.listenbrainz.org/1/playlist/7bbc9a5d-dbf1-44bd-9cc8-97b505ef4a53/export/spotify
      [HTTP/2 500 Internal Server Error 656ms]

      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.listenbrainz.org/1/playlist/7bbc9a5d-dbf1-44bd-9cc8-97b505ef4a53/export/spotify. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 500.

      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://play.google.com/log?format=json&hasfast=true&authuser=0. (Reason: CORS request did not succeed). Status code: (null).

      The successful playlists work without these errors at console.

          [LB-1216] Exporting playlists to Spotify fails with some playlists

          Isabelxxx added a comment -

          Everything working now. Thanks Closing it now.

          And definitely that new feature will greatly help to get more listens!

          Isabelxxx added a comment - Everything working now. Thanks Closing it now. And definitely that new feature will greatly help to get more listens!

          Monkey added a comment - - edited

          Yes, this should be deployed in a few days. I can drop a comment here when it's out.

          With regard to Spotify, you might be interested in another feature we are working on to allow importing your entire Spotify listening history.
          I'm very keen on this feature for the same reason, to bring my friends in to ListenBrainz

          We are in the testing phase and still need to make the process easily understandable, so it's not ready yet.
          But one preliminary step for importing is getting the data from Spotify, which can take a month.
          In your Spotify account privacy setting page (https://www.spotify.com/account/privacy/) tick the "extended streaming history" and then click on "request data".
          They'll send you a download link by email.

          Monkey added a comment - - edited Yes, this should be deployed in a few days. I can drop a comment here when it's out. With regard to Spotify, you might be interested in another feature we are working on to allow importing your entire Spotify listening history. I'm very keen on this feature for the same reason, to bring my friends in to ListenBrainz We are in the testing phase and still need to make the process easily understandable, so it's not ready yet. But one preliminary step for importing is getting the data from Spotify, which can take a month. In your Spotify account privacy setting page ( https://www.spotify.com/account/privacy/ ) tick the "extended streaming history" and then click on "request data". They'll send you a download link by email.

          Isabelxxx added a comment - - edited

          Great

          I was suspecting something like that.

          Ironically it was working for some random playlist sizes over 100 (but maybe it was because some tracks were not on spotify and thus under 100 tracks added).

          Thank you so much for fixing it Spotify integration is the main reason I'm getting people into Listenbrainz hahahaha

          I suppose it will take some more days until it gets deployed, so I will try in a few days exporting them again.

          Isabelxxx added a comment - - edited Great I was suspecting something like that. Ironically it was working for some random playlist sizes over 100 (but maybe it was because some tracks were not on spotify and thus under 100 tracks added). Thank you so much for fixing it Spotify integration is the main reason I'm getting people into Listenbrainz hahahaha I suppose it will take some more days until it gets deployed, so I will try in a few days exporting them again.

          GitHub Bot added a comment -

          See code changes in pull request #93 submitted by amCap1712.

          GitHub Bot added a comment - See code changes in pull request #93 submitted by amCap1712 .

          Monkey added a comment -

          Sorry for the delay Isabelxxx.

          I looked into the issue and we are getting an error back from Spotify
          ERROR:spotipy.client:HTTP Error for PUT to https://api.spotify.com/v1/playlists/451yxSGCHNUSKSi2ekb550/tracks with Params: {} returned 400 due to You can add a maximum of 100 tracks per request.

          Apparently there is a limit to how many tracks we can add at once, and we all missed the small print that said so when we implemented our export function.
          I'm making a note that we need to process the tracks in batches of 100 max.

          Thanks for the report, hold on to your hat while we fix it

          Monkey added a comment - Sorry for the delay Isabelxxx . I looked into the issue and we are getting an error back from Spotify ERROR:spotipy.client:HTTP Error for PUT to https://api.spotify.com/v1/playlists/451yxSGCHNUSKSi2ekb550/tracks with Params: {} returned 400 due to You can add a maximum of 100 tracks per request. Apparently there is a limit to how many tracks we can add at once, and we all missed the small print that said so when we implemented our export function. I'm making a note that we need to process the tracks in batches of 100 max. Thanks for the report, hold on to your hat while we fix it

          Isabelxxx added a comment -

          Problem persists, is there any feedback about this?

          Exporting to Spotify is unusable with this bug and playback is also broken for those playlists.

          Isabelxxx added a comment - Problem persists, is there any feedback about this? Exporting to Spotify is unusable with this bug and playback is also broken for those playlists.

          Isabelxxx added a comment -

          Problem still present, so it is not due to a temporary error.

          Isabelxxx added a comment - Problem still present, so it is not due to a temporary error.

            kartik1712 amCap1712
            Isabelxxx Isabelxxx
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package