zotify-dev / zotify

A fast and customizable music and podcast downloader.
zlib License
898 stars 69 forks source link

Continually encountering "ValueError: invalid literal for int() with base 10:" error that skips the track #97

Open WaldoTheRanger opened 4 months ago

WaldoTheRanger commented 4 months ago

Here's a more complete version of the error:

[∙●∙] Preparing download... ###   SKIPPING: Aretha Franklin - I Take What I Want (GENERAL DOWNLOAD ERROR)   ###
Track_ID: 0cFXBak7fflKewgGUyhjCO
playlist_song_name: I Take What I Want
playlist: Jump to It
playlist_num: 043
playlist_id: 6f98XDvsx2QVUDXlTPF3hJ
playlist_track_id: 0cFXBak7fflKewgGUyhjCO

invalid literal for int() with base 10: 'Expires=1710498103~FullPath~hmac=pJW'

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/zotify/track.py", line 224, in download_track
    stream = Zotify.get_content_stream(track, Zotify.DOWNLOAD_QUALITY)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/zotify/zotify.py", line 53, in get_content_stream
    return cls.SESSION.content_feeder().load(content_id, VorbisOnlyAudioQuality(quality), False, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 722, in load
    return self.load_track(playable_id, audio_quality_picker, preload,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 783, in load_track
    return self.load_stream(file, track, None, preload, halt_listener)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 737, in load_stream
    return CdnFeedHelper.load_track(self.__session, track, file,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 339, in load_track
    streamer = session.cdn().stream_file(file, key, url, halt_listener)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 442, in stream_file
    CdnManager.CdnUrl(self, file.file_id, url),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/librespot/audio/__init__.py", line 487, in __init__
    self.set_url(url)
  File "/usr/lib/python3.11/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=1710498103~FullPath~hmac=pJW'

No idea why no one else seems to have this I haven't done anything too crazy with my settings

JohnHenry66 commented 4 months ago

You're not alone, I've been randomly getting songs skipped with that error for weeks and I've been wondering why nobody's posted about it. The same issue happens on all my devices.

samiy803 commented 4 months ago

Seems to be a problem with librespot. For a temp fix, just edit the file manually:

  1. Run pip show librespot and take note of the location
  2. Comment out line 531 of {location}/audio/__init__.py
  3. Add self.__expiration = -1
 # self.__expiration = int(token_url.query[:i]) * 1000
 self.__expiration = -1
WaldoTheRanger commented 4 months ago

Thank you kind sir

Now I only get other errors

sometimes still see a "404", which for some reason is not something it attempts to retry when it encounters

There's a "retry this many times" setting, but it apparently only functions for retrieving lyrics, nothing else important [eye roll emoji]

This has helped a lot though much thanks