Open AmarnathCJD opened 4 months ago
POST https://gae2-spclient.spotify.com/playplay/v1/key/fcaee7629075da20d8765dfeac0608841c68daef HTTP/1.1 Host: gae2-spclient.spotify.com Connection: keep-alive Content-Length: 30 Accept-Language: en App-Platform: Win32_x86_64 Spotify-App-Version: 123900578 User-Agent: Spotify/123900578 Win32_x86_64/Windows 10 (10.0.22631; x64; AppX) Content-Type: application/x-www-form-urlencoded
its resolved like this ig
What does this request?
What does this request?
I got it from intercepting Spotify windows client, as web client only allow low quality audio playback. This req returns the key for decryption ig, need more investigation with windows client.
Could a post a sample of the request and response if you have the time?
The only other piece of information I found is this TypeScript file: https://github.com/DaXcess/node-spotify-ap/blob/main/lib/audio/AudioKeyManager.ts#L10 which indicates that i have to parse the needed information as protobuf.
I compiled the playplay.proto file to a *_pb2.py file
protoc.exe --proto_path=proto --pyi_out=gen proto/playplay.proto
and used it with the requests module to query the endpoint. But it seems like I'm not able to understand the mentioned file good enough as I don't know what the 'cache_id' is supposed to be.
The official librespot python module doesn't mention the PlayPlayRequest.
I also tried just sending a raw widevine challenge to the endpoint but that returned a 403 (Forbidden) error code.
My code:
req = playplay_pb2.PlayPlayLicenseRequest(
version=3,
cache_id=b'\x00',
interactivity=playplay_pb2.Interactivity.INTERACTIVE,
content_type=playplay_pb2.ContentType.AUDIO_TRACK,
)
response = requests.post(
url='https://gae2-spclient.spotify.com/playplay/v1/key/c0f23483a2a7634a09a7b209ef2242c9b4b03ab0',
data=req.SerializeToString(),
headers={
'Content-Type': 'application/x-protobuf',
'App-Platform': 'Win32',
"Authorization": f'Bearer {token_manager.get_access_token()}'
}
)
Could you help me out here?
Could a post a sample of the request and response if you have the time? The only other piece of information I found is this TypeScript file: https://github.com/DaXcess/node-spotify-ap/blob/main/lib/audio/AudioKeyManager.ts#L10 which indicates that i have to parse the needed information as protobuf. I compiled the playplay.proto file to a *_pb2.py file
protoc.exe --proto_path=proto --pyi_out=gen proto/playplay.proto
and used it with the requests module to query the endpoint. But it seems like I'm not able to understand the mentioned file good enough as I don't know what the 'cache_id' is supposed to be. The official librespot python module doesn't mention the PlayPlayRequest. I also tried just sending a raw widevine challenge to the endpoint but that returned a 403 (Forbidden) error code.My code:
req = playplay_pb2.PlayPlayLicenseRequest( version=3, cache_id=b'\x00', interactivity=playplay_pb2.Interactivity.INTERACTIVE, content_type=playplay_pb2.ContentType.AUDIO_TRACK, ) response = requests.post( url='https://gae2-spclient.spotify.com/playplay/v1/key/c0f23483a2a7634a09a7b209ef2242c9b4b03ab0', data=req.SerializeToString(), headers={ 'Content-Type': 'application/x-protobuf', 'App-Platform': 'Win32', "Authorization": f'Bearer {token_manager.get_access_token()}' } )
Could you help me out here?
Yeah wait till tommorow I'll send the details;
you could try intercepting windows Spotify client requests using Fiddler and try to understand the woorking.
r = requests.post(
url="https://gew4-spclient.spotify.com/playplay/v1/key/f9608d4d11ce765a2f901fa8fddf76b0fd9d9e81",
headers={
"Authorization": f"Bearer {token_manager.get_access_token()}",
},
data=bytes.fromhex("0803121001a3840cfd43462497863e0d52139bd62001280130e7fec4b406")
)
print(r.status_code, r.content.hex())
# 200 0a1058cb0cd8f16b0f7bd4fe0890910a7e4412040895d37d
This works
that sounds cool
But the next steps?
Some analysis later i got to this point:
PlayPlayLicenseRequest:
version: 3
token: 01a3840cfd43462497863e0d52139bd6
interactivity: INTERACTIVE
content_type: AUDIO_TRACK
PlayPlayLicenseResponse:
obfuscated_key: aaedcf042aae01f00836ed93e2ca1c71
I parsed the request and response as Protobuf and got this.
Next step would be to figure out how to use the output and where the input comes from. Do you know if the spotify client javascript-based?
ok it seems like this is quite complicated. For reference:
https://github.com/librespot-org/librespot-java/discussions/421
https://github.com/librespot-org/librespot-java/discussions/421/comments/1812935/threads
wait can we rec eng libspot to get the track.?
if you ever figure out anything more please post here, these seems interesting
I'll try to, yes
I did it!
Look at this: https://github.com/librespot-org/librespot-java/discussions/421#discussioncomment-10035969
I did it! Look at this:
https://github.com/librespot-org/librespot-java/discussions/421#discussioncomment-10035969
where to get the playplay.exe ?
I won't upload it here but it's the decrypt code leaked compiled using CMake on Windows. The code is accessible on the internet, that's all I'm going to say.
I won't upload it here but it's the decrypt code leaked compiled using CMake on Windows. The code is accessible on the internet, that's all I'm going to say.
ah come.on just a hint where to find the uncompiled version :(
github
github
suischan?
that got taken down, but it can still be found. just search for it
wow that's amazing 😹😹
seems like it worked?
seems like it worked?
Yup figuring out how to write the ogg headers
let me know if you figure something out, as i was only able to play the file using vlc. ffmpeg failed
let me know if you figure something out, as i was only able to play the file using vlc. ffmpeg failed
https://gist.github.com/AmarnathCJD/ef4c368c38d5dfcb76f520dd76076189
here
after that you can rebuild proper metadata via ffmpeg
Do you mind if integrate this into my spotify downloader that I'm developing? Also, while you're at it, could you also do this to the AAC_24 quality, as it's also protected using the same system?
yeah go on.
On Sat, Jul 13, 2024, 4:07 PM larley @.***> wrote:
Do you mind if integrate this into my spotify downloader that I'm developing?
— Reply to this email directly, view it on GitHub https://github.com/JustYuuto/spotify-downloader/issues/10#issuecomment-2226851292, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARJ64S6IRD4T5OYLTFNLFOLZMD7O3AVCNFSM6AAAAABJN7LYD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWHA2TCMRZGI . You are receiving this because you authored the thread.Message ID: @.***>
A sample aac file sample_aac.zip
Do you mind if integrate this into my spotify downloader that I'm developing? Also, while you're at it, could you also do this to the AAC_24 quality, as it's also protected using the same system?
Ah aac
why do we need it?
isn't ogg 320 the best quality
Sure, but i'd like the downloader to support it too. It's up to you if you want to create another rebuilder.
I'll try;
A sample aac file sample_aac.zip
this aint even playable in vlc
https://gist.github.com/AmarnathCJD/7c3a804e7685b0237f6da42d32f7986a
try with this
No luck, did you get it to work?
No luck, did you get it to work?
is the decrypt failing on some songs??
for eg;- https://open.spotify.com/track/2qSkIjg1o9h3YT9RAgYN75
are you able to do on this.
Yes, i've had this too. Don't know why this is happening...
What i do know is that you can go down to OGG_VORBIS_160 and it should work (that's what the desktop app is requesting by default)
What i do know is that you can go down to OGG_VORBIS_160 and it should work (that's what the desktop app is requesting by default)
Is this still working?
Of course, just make sure to compile the latest playplay version: https://git.gay/uhwot/unplayplay the old one got deprecated.
Ah that was the reason meyb it was failing and what about the playplay keys??
On Wed, Nov 6, 2024, 1:04 AM larley @.***> wrote:
Of course, just make sure to compile the latest playplay version: https://git.gay/uhwot/unplayplay the old one got deprecated.
— Reply to this email directly, view it on GitHub https://github.com/JustYuuto/spotify-downloader/issues/10#issuecomment-2458002283, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARJ64SY2LI5JD7R2BMBKHD3Z7EMS7AVCNFSM6AAAAABJN7LYD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJYGAYDEMRYGM . You are receiving this because you authored the thread.Message ID: @.***>
[ogg @ 000001dcbcc31e80] Format ogg detected only with low score of 1, misdetection possible! [ogg @ 000001dcbcc31e80] cannot find sync word [in#0 @ 000001dcbcc1b480] Error opening input: Invalid data found when processing input Error opening input file C:\Users\amarn\spotify-downloader\Desperado-encrypted.ogg. Error opening input files: Invalid data found when processing input Error: Command '['ffmpeg', '-decryption_key', '1a4adea5249948f37a53f11efddfb2c8', '-i', 'C:\Users\amarn\spotify-downloader\Desperado-encrypted.ogg', 'C:\Users\amarn\spotify-downloader\Desperado.ogg']' returned non-zero exit status 3199971767.