Closed diveflo closed 2 years ago
I'll look into this, Spotify may have changed something somewhere somehow.
I have the same issue. Worked for a day with a newly created account. Now it is not working again. Can still log in to the accounts. At the moment it seems like an internal ban, but could be something else that I triggered by creating and using a new account.
I don't think this is caused by any banning, what seems to have happened is that Spotify has changed the way external streams are served. The current web client uses episodes[].external_playback_url
to get the URL of the stream to play which is not present in the data served when using the authentication token generated by librespot:
Using a token gleaned from the web player:
$ curl -s 'https://api.spotify.com/v1/episodes?ids=78jHXrnIMJp5oLFsM2edS7' -H 'authorization: Bearer BQA-RnNIWkUGm4bHA1UVTrDpvzjOr4OLZXX-GySBuaEYn22DigMUbC201orHzmQZPcCU0SPS6nRUBhadjZoziNfNmK4suUzgMngvXBWsOdZ4D9f-ABCDEFGHIJKWERGn4hGibHWo0sFBrvNDlsw8KGMI2svbK_H1ufAMbSCdLOG3bknHhIXTc3G2gHxYWFQVmZi_p751JLzyfBIaIOxo4AQWC54gtgcyBb8TcNCi-BiHTVJ8UUpIL8Ab1v1Uvz8pFWHtKEi4U2HeO039cG_v6F8KmKbFwbJCZeKm0MeWjqkwQxmJdWB5MpetMKWuGgQT151oxA8EHp3TJYBtRC96ZcPSyw' |grep external_playback_url
"external_playback_url" : "https://traffic.megaphone.fm/GLT8613565834.mp3?updated=1655823165",
$
Using a token generated by librespot
$ curl -s 'https://api.spotify.com/v1/episodes?ids=78jHXrnIMJp5oLFsM2edS7' -H 'authorization: Bearer BQDqtW9lsyWEu6Uvgb44ELVt18EXQP0FUfbf_AzKaoMeSLXBS13Wd5dfBOg2OqeU0jfDTxf_gLPO3EHHGfboF0ydBi3iAVjDv4pABCDEFGHIJKwOHrMWdaWySl-ej_nLZHbDoi79koauMPi0dJsz2_DhMNYHs1ZSHDDkHLriki-PimVYitM6XsI8eoAKUkk9EcmuLefyPeeCE6NXTw4rivzGWbxnuNTIM1E4YdtkUqEAPprc-CMP1BYF5FuExWtHsuwceLfqPghKDZs1K3HTDxnZms4LQl0' |grep external_playback_url
$
These two versions use the same Spotify account, the only difference is where the token was generated. There are bug reports out on a similar problem for librespot (the rust version): https://github.com/librespot-org/librespot/issues/818 where they also notice the required URL is not present.
(note: these tokens are edited and will not work, generate your own...)
What rests is to find which scope/dealer/protocol_version/... is needed for Spotify to serve the required data. If you feel like digging I'd suggest loading the web client and start observing what comes by when it authenticates etc.
The root cause of this problem seems to be clear now (https://github.com/kokarare1212/librespot-python/issues/135) , working on a solution...
Fixed in v0.5.0
Fixed in v0.5.0
Please update the docker image
Fixed in v0.5.0
Please update the docker image
@heywoodlh This is for you
@Yetangitu Docker Hub image has been updated: heywoodlh/spodcast:0.5.0! Thanks for pinging me, I didn't even realize that my podcasts haven't gotten an update for a couple weeks. :smile:
Clearly you need more interesting podcasts...
For those who don't read release notes:
This release:
To get spodcast to fetch those episodes it missed while #13 reared its ugly head (i.e. between 2022-06-16 and 2022-06-30) you can temporarily increase --max-episodes
(or sync
in the web interface, although that only goes up to 5) to whatever number of episodes you expect have been missed - the number depends on the release frequency.
I can't download individual episodes whit docker
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: MX
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 31g47gqhgxqaqdw2yunf43hwvrbi!
INFO:spodcast.podcast:Fetching episode information...
Traceback (most recent call last):
File "/usr/local/bin/spodcast", line 8, in
What happens when you feed it a show link? Does it download episodes or do you get the same error?
I can confirm this problem and will produce a fix r.s.n.
Fixed in v0.5.1
@heywoodlh once more, please...
Done!
For one of my podcasts (Gemischtes Hack) i cannot download episodes most of the time, strangely sometimes it is downloading without an error. Here is the log:
INFO:Librespot:Session:Created new session! device_id: XXX, ap: ap-gew1.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: DE
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 XXX
INFO:spodcast.podcast:Fetching episode information...
INFO:spodcast.podcast:Downloading file
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 438, in _error_catcher
yield
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/usr/lib/python3.9/http/client.py", line 458, in read
n = self.readinto(b)
File "/usr/lib/python3.9/http/client.py", line 502, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2622)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alex/.local/bin/spodcast", line 8, in <module>
sys.exit(main())
File "/home/alex/.local/lib/python3.9/site-packages/spodcast/__main__.py", line 42, in main
args.func(args)
File "/home/alex/.local/lib/python3.9/site-packages/spodcast/app.py", line 30, in client
download_episode(episode_id)
File "/home/alex/.local/lib/python3.9/site-packages/spodcast/podcast.py", line 173, in download_episode
path, size, mimetype = download_file(download_url, filepath)
File "/home/alex/.local/lib/python3.9/site-packages/spodcast/podcast.py", line 92, in download_file
shutil.copyfileobj(r.raw, file)
File "/usr/lib/python3.9/shutil.py", line 205, in copyfileobj
buf = fsrc_read(length)
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/urllib3/response.py", line 449, in _error_catcher
raise SSLError(e)
urllib3.exceptions.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2622)
I just tried that podcast (https://open.spotify.com/show/7BTOsF2boKmlYr76BelijW?si=dad40f01e89a48ba) and had no such problems. The episodes are hosted externally from Spotify, content comes from https://dcs.megaphone.fm/
. This is not a problem with either spodcast, librespot-python or Spotify. It can be a problem with the hosting provider, with OpenSSL, with a transparent proxy somewhere between you and dcs.megaphone.fm
or anything else which interferes with traffic between the two.
Ok. Thank you for the clarification. I will continue to monitor this problem. Maybe it resolves itself in a few days.
Hi,
somehow I cannot download anymore episodes.
The full log:
Notes:
Let me know if I can assist somehow:) Thanks!