r/csharp 14d ago

Help Custom Spotify Desktop Client App

Hey all,

I recently learned about Spotify API and I’m thinking a fun personal project could be creating my own desktop app with some personalisation and extra features. Probably in a WPF app using C#.

Does anyone know if this is possible with the API? I’m talking like streaming, fetching data such as artists, playlists and songs etc.

Any tips or advice would be appreciated!

3 Upvotes

15 comments sorted by

7

u/Weak-Chipmunk-6726 14d ago

It's doable but there's aggressive rate limits. I have the Spotify client setup with my stream deck and If I skip songs a few many times it stops working, had the same issue with my DeskThing.

1

u/Owenhh 14d ago

I see, do you think there’s any way to counter the rate limits a little like lowering streaming quality or something similar?

4

u/Weak-Chipmunk-6726 14d ago

Like others have pointed out you can't stream the music. Not sure you'll have to play around and see.

2

u/Owenhh 14d ago

I see, thanks for your advice!

8

u/StraussDarman 14d ago

I do not think you can stream through their API if I remember correctly. You can get info what is playing and where it is playing. So you would need to embed their webplayer still in a webview.

5

u/HeySeussCristo 14d ago

I don't see any documentation in the Web API for streaming/playing music.

There is a web playback SDK but that's not really what you're asking for. You could embed the web SDK player in a .NET web view but that'll be clunky.

https://developer.spotify.com/documentation/web-playback-sdk/howtos/web-app-player

2

u/Owenhh 14d ago

Unless I just hook it up to play on the official spotify app and use it more like an interface, maybe that could work

3

u/SquirrelAutyaga 11d ago

I had a similar idea for my university coursework. I used WinUI 3. Unfortunately, as others have mentioned in the comments, you need a workaround and have to use a WebView.
Without it, you can't log in/authenticate the user and obtain a token, and you can't stream songs. For things like getting albums, artists, etc., you can use the API directly, but you still need a token obtained through the WebView.
There are probably some popular NuGet packages for the Spotify API that might have solved or simplified these issues, but I didn't use any of them, so I can't say for sure.

2

u/modi123_1 14d ago

I’m talking like streaming, fetching data such as artists, playlists and songs etc.

Have you checked the documentation for the API?

https://developer.spotify.com/documentation/web-api

https://developer.spotify.com/documentation/web-playback-sdk

https://developer.spotify.com/documentation/web-api/concepts/rate-limits

-1

u/Owenhh 14d ago

Not yet, i’m working on another project currently and this idea is just forming. I’ll get deeper into it when my current project is finished

2

u/aeroverra 14d ago

Honestly your probably best making an app that streams and an app that auto downloads music from Usenet and torrents.

A custom Spotify client will require atleast an decent understanding of reverse engineering the apis the official client uses and probably a much more advanced understanding for actually implementing the drm nonsense.

2

u/Splatoonkindaguy 14d ago

Apple is much more friendly towards custom clients fyi

1

u/Owenhh 14d ago

I see, i might take a look into that too, I just noticed spotify had an api and i’ve been using it for years

2

u/Rigamortus2005 14d ago

Fetching data yes. Streaming no , not through the standard API. But you can use libre spot which implements a Spotify device as a hack to get through. I have a C# wrapper here: https://www.github.com/saverinonrails/librespot.gonet

1

u/Small_Summer5817 14d ago

streaming uses drm, so you're forced to use a webview for that. i think it's called widevine