Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podcasts/Shows not being fetched properly #515

Open
m4r1vs opened this issue Jan 16, 2025 · 1 comment
Open

Podcasts/Shows not being fetched properly #515

m4r1vs opened this issue Jan 16, 2025 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@m4r1vs
Copy link

m4r1vs commented Jan 16, 2025

Describe the bug
The spotify API returns "null" as part of the "items" for some Podcasts (for example Lateral by Tom Scott). The response JSON looks like this:

...ITEMS[]...
      "is_playable": true,
      "language": "en",
      "languages": [
        "en"
      ],
      "name": "118: The wrong way wheel",
      "release_date": "2025-01-10",
      "release_date_precision": "day",
      "resume_point": {
        "fully_played": true,
        "resume_position_ms": 0
      },
      "type": "episode",
      "uri": "spotify:episode:2OcsbZmwFB0GBiuLQHsEQU"
    },
    null <=== WEIRD NULL
  ],
...METADATA...

To Reproduce
Steps to reproduce the behavior:

  1. Clone my fork of spotify_player and cd into https://github.com/m4r1vs/spotify-player/tree/master/debugging
  2. cargo run
  3. Notice the error
  4. Notice that using Option<SimpliefiedEpisode> fixes this.

Expected behavior
I expect all episodes to be loaded properly.

Log/Output data
Serde is not able to parse the json.

Additional context
I use spotify_player for music playback and have long been plagued by some podcasts not loading. Now that I have examps coming up, it's the perfect time to procrastinate on open source lol

@m4r1vs m4r1vs added bug Something isn't working help wanted Extra attention is needed labels Jan 16, 2025
@ramsayleung
Copy link
Owner

It seems that Spotify has changed the behavior of their APIs again, I've encountered this problem more times than I can count. Originally, the API returned a SimplifiedEpisode. If an episode was null, it would skip it and return nothing.

To address this issue, I have an idea: instead of directly updating the return type from SimplifiedEpisode to Option<SimplifiedEpisode>, I prefer to introduce a wire version that is flexible and adaptable to any changes Spotify makes. This approach allows us to continue using SimplifiedEpisode as the facade version without introducing breaking changes for library users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants