Hacker News new | past | comments | ask | show | jobs | submit login

Protip: librespot doesn't actually require premium

Just modify the authentication code in https://github.com/librespot-org/librespot-golang/blob/maste... to look something like this:

        packet := &Spotify.ClientResponseEncrypted{
                LoginCredentials: &Spotify.LoginCredentials{
                        Username: proto.String(username),
                        Typ:      authType,
                        AuthData: authData,
                },
                AccountCreation: Spotify.AccountCreation_ACCOUNT_CREATION_ALWAYS_PROMPT.Enum(),
                SystemInfo: &Spotify.SystemInfo{
                        CpuFamily: Spotify.CpuFamily_CPU_X86_64.Enum(),
                        CpuSubtype:              proto.Uint32(0),
                        Brand: Spotify.Brand_BRAND_UNBRANDED.Enum(),
                        BrandFlags:              proto.Uint32(0),
                        Os:                      Spotify.Os_OS_LINUX.Enum(),
                        OsVersion:               proto.Uint32(0),
                        OsExt:                   proto.Uint32(0),
                        SystemInformationString: proto.String("Linux [x86-64 0]"),
                        DeviceId:                proto.String("libspotify"),
                },
                PlatformModel: proto.String("PC desktop"),
                VersionString: ...,
                ClientInfo: &Spotify.ClientInfo{
                        Limited:  proto.Bool(false),
                        Language: proto.String("en"),
                },
        }

In the go version of the library they set some boolean in the request that makes it not work with free accounts but if you change it to this it will work. You can also use this Wireshark dissector to read Spotify protobuf messages directly: https://github.com/plietar/spotify-analyze/blob/master/disse...

Then you can make the authentication packet look exactly like the desktop client (though this is not required because Spotify has lax validation).




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: