CriticalElement / spotify-free-api-player

This allows you to modify the user's playback state through the spotify API, without needing premium.
13 stars 1 forks source link

Error : AttributeError: 'SpotifyPlayer' object has no attribute 'access_token_expire' #3

Closed Abdulsamipy closed 2 years ago

Abdulsamipy commented 2 years ago

Hello, i am running example.py and i have also logged into the spotify once on chrome.

i am getting the following error

AttributeError: 'SpotifyPlayer' object has no attribute 'access_token_expire'

Abdulsamipy commented 2 years ago

i am fairly new to python got started 2 months ago, i am working on a bot to stream songs with spotify api, i am able to get the access code and also the auth token but unable to play song using the endpoint https://api.spotify.com/v1/me/player/play , it is asking for the "premium account" in the response

Secondly can you also tell me how your spoofing the device

it will mean alot

Thanks

CriticalElement commented 2 years ago

The regular spotify player api requires premium in order to control the user's playback state. However, with this library you can use the command spotifyplayer.command(spotifyplayer.resume) (with spotifyplayer being the instance of the SpotifyPlayer class you create) in order to resume the user's playback. Check examples.py to see an example where it plays a specific song.

Also, this library cannot stream songs directly from spotify. Instead, it creates a fake device that can control playback on other devices, which you may already know - I just couldn't tell from the wording of the message.

About your error that you were getting - I'm looking into it right now but make sure that when you logged in to spotify with chrome that you checked the Remember Me box, so that the cookie can get saved.

CriticalElement commented 2 years ago

On further inspection - this seems to be a problem with the browser_cookie3 library - will look for a fix

CriticalElement commented 2 years ago

alright i updated the requirements to change the browser_cookie3 to a forked repo with a bugfix, so it should work now! run pip install -r requirements.txt or a similar command depending on your install to reinstall all of the requirements, and it should work

I'll close this if it works for you - gonna wait for your response