Yetangitu / Spodcast

Spodcast is a caching Spotify podcast to RSS proxy. Using Spodcast you can follow Spotify-hosted netcasts/podcasts using any player which supports RSS, thus enabling the use of older hardware which is not compatible with the Spotify (web) app.
GNU General Public License v3.0
355 stars 14 forks source link

It stoped working #40

Open hugolinhares opened 10 months ago

hugolinhares commented 10 months ago

It stoped working for me, I'm getting these error messages:

INFO:Librespot:Session:Created new session! device_id: 4111fdfe595800dc705aa0ff4939b59ac595283c, ap: ap-gae2.spotify.com:80 INFO:Librespot:Session:Connection successfully! INFO:Librespot:Session:Session.Receiver started INFO:Librespot:Session:Skipping 02 INFO:Librespot:Session:Received license_version: 0 INFO:Librespot:Session:Received country_code: BR INFO:Librespot:Session:Skipping 1f INFO:Librespot:Session:Skipping 69 INFO:Librespot:Session:Skipping unknown command cmd: 0x75, payload: b'\x00\x00\x00' INFO:Librespot:Session:Authenticated as 31d2eplb6lsuy77uikekqfzj5w44! INFO:Librespot:Session:Created new session! device_id: a59001678e10ffd39b38e2112629011548862466, ap: ap-gue1.spotify.com:443 INFO:Librespot:Session:Connection successfully! INFO:Librespot:Session:Closing session. device_id: a59001678e10ffd39b38e2112629011548862466 INFO:Librespot:Session:Closed session. device_id: a59001678e10ffd39b38e2112629011548862466 Traceback (most recent call last): File "/usr/local/bin/spodcast", line 8, in sys.exit(main()) ^^^^^^ File "/usr/local/lib/python3.12/site-packages/spodcast/main.py", line 42, in main args.func(args) File "/usr/local/lib/python3.12/site-packages/spodcast/app.py", line 14, in client Spodcast(args) File "/usr/local/lib/python3.12/site-packages/spodcast/spodcast.py", line 54, in init Spodcast.login() File "/usr/local/lib/python3.12/site-packages/spodcast/spodcast.py", line 78, in login session = Session.Builder(conf).stored_file().create() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/librespot/core.py", line 1287, in create session.authenticate(self.login_credentials) File "/usr/local/lib/python3.12/site-packages/librespot/core.py", line 709, in authenticate self.__authenticate_partial(credential, False) File "/usr/local/lib/python3.12/site-packages/librespot/core.py", line 1067, in __authenticate_partial raise Session.SpotifyAuthenticationException(ap_login_failed) librespot.core.Session.SpotifyAuthenticationException: BadCredentials

svwb22 commented 9 months ago

Look at the last line. It literally says “bad credentials” there. Renew the authentication and it’ll work again.

hugolinhares commented 9 months ago

Look at the last line. It literally says “bad credentials” there. Renew the authentication and it’ll work again.

Can you explain how I can do that? I have tried everything, even creating a new account and the problem persist.

svwb22 commented 9 months ago

Depends on how you set it up initially. If you used docker, I would recommend to delete the container which authenticated you at Spotify, create the new “spotify.rc”-file with your credentials: mkdir -p /tmp/spodcast

echo 'spotify_username spotify_password' > /tmp/spodcast/spotify.rc

Then set up a new container with: docker run -it -v /tmp/spodcast:/data heywoodlh/spodcast -c /data/spodcast.json --root-path /data/html --log-level info --credentials-location /data/creds.json -p -l /data/spotify.rc

hugolinhares commented 9 months ago

Depends on how you set it up initially. If you used docker, I would recommend to delete the container which authenticated you at Spotify, create the new “spotify.rc”-file with your credentials: mkdir -p /tmp/spodcast

echo 'spotify_username spotify_password' > /tmp/spodcast/spotify.rc

Then set up a new container with: docker run -it -v /tmp/spodcast:/data heywoodlh/spodcast -c /data/spodcast.json --root-path /data/html --log-level info --credentials-location /data/creds.json -p -l /data/spotify.rc

I tried this, but unfortunately the problem still persists. Is your container working normally? After all the steps a got this log:

INFO:Librespot:Session:Connection successfully!
INFO:Librespot:Session:Session.Receiver started
INFO:Librespot:Session:Skipping 02
INFO:Librespot:Session:Received license_version: 0
INFO:Librespot:Session:Received country_code: BR
INFO:Librespot:Session:Skipping 1f
INFO:Librespot:Session:Skipping 69
INFO:Librespot:Session:Authenticated as 31r762xamnbb2e6alobmuchgb7lu!
INFO:Librespot:Session:Skipping unknown command cmd: 0x75, payload: b'\x00\x00\x00'
INFO:spodcast.podcast:Fetching episode information...
INFO:spodcast.podcast:Downloading stream
WARNING:spodcast.podcast:Downloaded Respondendo em Voz Alta: T3E24 — Episódio 69
INFO:spodcast.podcast:Fetching show information...
INFO:spodcast.podcast:Downloading file
INFO:spodcast.podcast:Fetching episode information...
Traceback (most recent call last):
  File "/usr/local/bin/spodcast", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spodcast/__main__.py", line 42, in main
    args.func(args)
  File "/usr/local/lib/python3.12/site-packages/spodcast/app.py", line 30, in client
    download_episode(episode_id)
  File "/usr/local/lib/python3.12/site-packages/spodcast/podcast.py", line 167, in download_episode
    stream = Spodcast.get_content_stream(episode_stream_id, Spodcast.DOWNLOAD_QUALITY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/spodcast/spodcast.py", line 111, in get_content_stream
    return cls.SESSION.content_feeder().load(content_id, VorbisOnlyAudioQuality(quality), False, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 725, in load
    return self.load_episode(playable_id, audio_quality_picker,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 763, in load_episode
    return self.load_stream(file, None, episode, preload, halt_listener)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 739, in load_stream
    return CdnFeedHelper.load_episode(self.__session, episode, file,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 391, in load_episode
    streamer = session.cdn().stream_file(file, key, url, halt_listener)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 442, in stream_file
    CdnManager.CdnUrl(self, file.file_id, url),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 487, in __init__
    self.set_url(url)
  File "/usr/local/lib/python3.12/site-packages/librespot/audio/__init__.py", line 531, in set_url
    self.__expiration = int(token_url.query[:i]) * 1000
                        ^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Expires=1703029890~FullPath~hmac=R'
padok commented 4 months ago

I have encountered a similar problem.

Is it possible that you have special characters in your password? For example, $ characters are interpreted by docker-compose and therefore do not make it into the configuration of spodcast.

For example, if your password contains a symbol like $, you probably have the default docker-compose.yml file set up something similar to this:

  - SPOTIFY_PASSWORD=$abcde!fghi
  - SPOTIFY_USERNAME=user@mail.com

however, since the $ characters are interpreted by docker-compose and there is like no variable $abcde present, only the string after another special or limiting character is passed to the enviroment:

expected spotify.rc content: user@mail.com $abcde!fghi

actual spotify.rc content: user@mail.com !fghi

Recommended solution: You must escape special characters, e.g. escape $ signs by replacing them with $$.

Edit: I just tested it, and you also need to escape the $ for the shell I guess? So for the example used:

- SPOTIFY_PASSWORD=$abcde!fghi becomes - SPOTIFY_PASSWORD=\$$abcde!fghi

hugolinhares commented 4 months ago

Padok the problem was a "." in my password. Thank you very much for the help!!

romanzipp commented 2 months ago

I'm too getting the BadCredentials error. Credentials stored in the .rc file and are correct. Also checked for special characters. Is the authentication still working with Spotify?

spodcast -l data/spotify.rc --log-level DEBUG

Logs

  File "/Users/john/.local/bin/spodcast", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/__main__.py", line 42, in main
    args.func(args)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/app.py", line 14, in client
    Spodcast(args)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/spodcast.py", line 49, in __init__
    Spodcast.account(line.strip())
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/spodcast.py", line 64, in account
    session = Session.Builder(conf).user_pass(username, password).create()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 1287, in create
    session.authenticate(self.login_credentials)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 709, in authenticate
    self.__authenticate_partial(credential, False)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 1067, in __authenticate_partial
    raise Session.SpotifyAuthenticationException(ap_login_failed)
librespot.core.Session.SpotifyAuthenticationException: BadCredentials
itslewin commented 1 month ago

I'm too getting the BadCredentials error. Credentials stored in the .rc file and are correct. Also checked for special characters. Is the authentication still working with Spotify?

spodcast -l data/spotify.rc --log-level DEBUG

Logs

  File "/Users/john/.local/bin/spodcast", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/__main__.py", line 42, in main
    args.func(args)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/app.py", line 14, in client
    Spodcast(args)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/spodcast.py", line 49, in __init__
    Spodcast.account(line.strip())
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/spodcast/spodcast.py", line 64, in account
    session = Session.Builder(conf).user_pass(username, password).create()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 1287, in create
    session.authenticate(self.login_credentials)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 709, in authenticate
    self.__authenticate_partial(credential, False)
  File "/Users/john/.local/pipx/venvs/spodcast/lib/python3.12/site-packages/librespot/core.py", line 1067, in __authenticate_partial
    raise Session.SpotifyAuthenticationException(ap_login_failed)
librespot.core.Session.SpotifyAuthenticationException: BadCredentials

No, Spotify removed username/password login, see https://github.com/Yetangitu/Spodcast/issues/46